--- centos-errata.py.orig 2010-07-08 16:47:29.000000000 -0400 +++ centos-errata.py 2010-07-08 16:42:08.000000000 -0400 @@ -589,8 +589,7 @@ def process_args(): config = ConfigParser.SafeConfigParser() - config.readfp(open(CONFIG_FILE)) - + parser = OptionParser(usage="%prog [options] [filename]",version="%prog 0.2") addRequiredOptions(parser) @@ -608,6 +607,8 @@ help="Do not connect to the RHN server, just process the input file and print errata information. Will also print configuration information") parser.add_option("","--centos-version",type="string",dest="centos_version", help="The centos version (e.g. '5' for Centos 5.3) ") + parser.add_option("","--no-publish",action="store_true",dest="no_publish",default=False, + help="Leave errata unpublished.") #Have to perform DIRTY HACK here because optparse will exit early #if -h is passed, not what we want since we only want to retrieve @@ -627,6 +628,8 @@ if len(user_cfg_result) != 1 or user_cfg_result[0] != user_config: print "Failed to read config file %s " % user_config sys.exit(2) + else: + config.readfp(open(CONFIG_FILE)) interpolation_vars = {'version' : config.get("centos errata","version"), 'release' : config.get("centos errata","release")} @@ -652,7 +655,7 @@ if config.has_option("spacewalk","server"): parser.set_defaults(server=config.get("spacewalk","server")) if config.has_option("spacewalk","password"): - parser.set_defaults(password=config.get("spacewalk","password")) + parser.set_defaults(passwd=config.get("spacewalk","password")) if config.has_option("spacewalk","login"): parser.set_defaults(login=config.get("spacewalk","login")) if config.has_option("centos errata","scrape_rhn"): @@ -660,7 +663,7 @@ if config.has_option("centos errata", "max_errata"): parser.set_defaults(max_errata=config.getint("centos errata", "max_errata")) - + (options,args) = parser.parse_args() return (options,args) @@ -702,7 +705,10 @@ erratum = RHNErrata() erratum.advisoryName = advisory_name - erratum.publish = True + if options.no_publish: + erratum.publish = False + else: + erratum.publish = True if errata_type == SECURITY_ERRATA: info_match = sec_info_re.match(erratum_subject_match.group('other_info'))