utils/spacewalk-clone-by-date | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
New commits:
commit aabb5bb2b82cefb02a8cf15eb1600fa156aeb567
Author: Stephen Herr <sherr(a)redhat.com>
Date: Thu Jan 10 16:03:27 2013 -0500
889317 - Add more thorough arg validation to spacewalk-clone-by-date
diff --git a/utils/spacewalk-clone-by-date b/utils/spacewalk-clone-by-date
index 3d7cc50..9df9a55 100755
--- a/utils/spacewalk-clone-by-date
+++ b/utils/spacewalk-clone-by-date
@@ -157,6 +157,21 @@ def parse_args():
(options, args) = parser.parse_args()
+ if options.parents != None:
+ if (len(options.parents) != 2
+ or options.parents[0].startswith('-')
+ or options.parents[1].startswith('-')):
+ raise UserError("The -a / --parents option requires two
arguments")
+
+ # have to check this option before we merge with the config file to
+ # ensure that optparse is parsing the args correctly. We have to
+ # check it again after the config file merge.
+ if options.channels != None:
+ for channel_group in options.channels:
+ if (len(channel_group) != 2 or channel_group[0].startswith('-')
+ or channel_group[1].startswith('-')):
+ raise UserError("The -l / --channels option requires two
arguments")
+
if options.sample:
print SAMPLE_CONFIG
sys.exit(0)
@@ -164,6 +179,9 @@ def parse_args():
if options.config and options.channels:
raise UserError("Cannot specify both --channels and --config.")
+ if options.config and options.parents:
+ raise UserError("Cannot specify both --parents and --config.")
+
if options.blacklist:
options.blacklist = {"ALL":options.blacklist.split(",")}
@@ -180,12 +198,6 @@ def parse_args():
if existing.startswith('-') or
channel_group[existing].startswith('-'):
raise UserError("The -l / --channels option requires two
arguments")
- if options.parents != None:
- if (len(options.parents) != 2
- or options.parents[0].startswith('-')
- or options.parents[1].startswith('-')):
- raise UserError("The -a / --parents option requires two
arguments")
-
if not options.username:
raise UserError("Username not specified")
Show replies by date