utils/spacewalk-clone-by-date | 41 +++++++++++++++++++++++------------------
1 file changed, 23 insertions(+), 18 deletions(-)
New commits:
commit d5742d1c807f3fd001f05d5b8db940ce700a8298
Author: Stephen Herr <sherr(a)redhat.com>
Date: Thu Dec 20 15:07:41 2012 -0500
889317 - make sure the user passes two channels to spacewalk-clone-by-date
diff --git a/utils/spacewalk-clone-by-date b/utils/spacewalk-clone-by-date
index fc75712..41716d7 100755
--- a/utils/spacewalk-clone-by-date
+++ b/utils/spacewalk-clone-by-date
@@ -164,6 +164,11 @@ def parse_args():
if options.channels == None or len(options.channels) == 0:
raise UserError("No channels specified. See --help for details.")
+ else:
+ for channel_group in options.channels:
+ existing = channel_group.keys()[0]
+ if existing.startswith('-') or
channel_group[existing].startswith('-'):
+ raise UserError("The -l / --channels option requires two
arguments")
if not options.validate:
commit c8e1a6ac500a74a1171e23b95ec9a01a8bef8994
Author: Stephen Herr <sherr(a)redhat.com>
Date: Thu Dec 20 14:50:59 2012 -0500
Revert "889317 - migrate spacewalk-clone-by-date to argparse to avoid optparse
bug"
This reverts commit 4d31003ed6ed328412d0ef28b989de182cc36c99.
diff --git a/utils/spacewalk-clone-by-date b/utils/spacewalk-clone-by-date
index 2bacfdf..fc75712 100755
--- a/utils/spacewalk-clone-by-date
+++ b/utils/spacewalk-clone-by-date
@@ -23,7 +23,7 @@ import datetime
import getpass
import os
import StringIO
-from argparse import ArgumentParser
+from optparse import OptionParser
import simplejson as json
_LIBPATH = "/usr/share/rhn"
@@ -126,23 +126,23 @@ def transform_arg_channels(chan_list):
return [to_ret]
def parse_args():
- parser = ArgumentParser()
- parser.add_argument("-c", "--config", dest="config",
help="Config file specifying options")
- parser.add_argument("-u", "--username",
dest="username", help="Username")
- parser.add_argument("-p", "--password",
dest="password", help="Password")
- parser.add_argument("-s", "--server", dest="server",
help="Server URL to use for api connections (defaults to
https://localhost/rpc/api)", default="https://localhost/rpc/api")
- parser.add_argument("-l", "--channels",
dest="channels", nargs=2, action="append", help="Original channel
and clone channel labels space separated (e.g. --channels=rhel-i386-server-5 myclone).
Can be specified multiple times.")
- parser.add_argument("-b", "--blacklist",
dest="blacklist", help="Comma separated list of package names (or regular
expressions) to exclude from cloned errata (Only added packages will be
considered).")
- parser.add_argument("-r", "--removelist",
dest="removelist", help="Comma separated list of package names (or regular
expressions) to remove from destination channel (All packages are available for
removal).")
- parser.add_argument("-d", "--to_date", dest="to_date",
help="Clone errata to the specified date (YYYY-MM-DD)")
- parser.add_argument("-y", "--assumeyes",
dest='assumeyes', action='store_true', help="Assume yes for any
prompts (unattended).")
- parser.add_argument("-m", "--sample-config",
dest='sample', action='store_true', help="Print a sample full
configuration file and exit.")
- parser.add_argument("-k", "--skip_depsolve",
dest='skip_depsolve', action='store_true', help="Skip all dependency
solving (Not recommended).")
- parser.add_argument("-v", "--validate", dest='validate',
action='store_true', help="Run repoclosure on the set of specified
repositories.")
- parser.add_argument("-g", "--background",
dest='background', action='store_true', help="Clone the errata in the
background. Prompt will return quicker; before cloning is finished.")
- parser.add_argument("-o", "--security_only",
dest='security_only', action='store_true', help="Only clone security
errata (and their dependencies).")
-
- options = parser.parse_args()
+ parser = OptionParser()
+ parser.add_option("-c", "--config", dest="config",
help="Config file specifying options")
+ parser.add_option("-u", "--username", dest="username",
help="Username")
+ parser.add_option("-p", "--password", dest="password",
help="Password")
+ parser.add_option("-s", "--server", dest="server",
help="Server URL to use for api connections (defaults to
https://localhost/rpc/api)", default="https://localhost/rpc/api")
+ parser.add_option("-l", "--channels", dest="channels",
nargs=2, action="append", help="Original channel and clone channel labels
space separated (e.g. --channels=rhel-i386-server-5 myclone). Can be specified multiple
times.")
+ parser.add_option("-b", "--blacklist",
dest="blacklist", help="Comma separated list of package names (or regular
expressions) to exclude from cloned errata (Only added packages will be
considered).")
+ parser.add_option("-r", "--removelist",
dest="removelist", help="Comma separated list of package names (or regular
expressions) to remove from destination channel (All packages are available for
removal).")
+ parser.add_option("-d", "--to_date", dest="to_date",
help="Clone errata to the specified date (YYYY-MM-DD)")
+ parser.add_option("-y", "--assumeyes", dest='assumeyes',
action='store_true', help="Assume yes for any prompts (unattended).")
+ parser.add_option("-m", "--sample-config", dest='sample',
action='store_true', help="Print a sample full configuration file and
exit.")
+ parser.add_option("-k", "--skip_depsolve",
dest='skip_depsolve', action='store_true', help="Skip all dependency
solving (Not recommended).")
+ parser.add_option("-v", "--validate", dest='validate',
action='store_true', help="Run repoclosure on the set of specified
repositories.")
+ parser.add_option("-g", "--background",
dest='background', action='store_true', help="Clone the errata in the
background. Prompt will return quicker; before cloning is finished.")
+ parser.add_option("-o", "--security_only",
dest='security_only', action='store_true', help="Only clone security
errata (and their dependencies).")
+
+ (options, args) = parser.parse_args()
if options.sample:
print SAMPLE_CONFIG