Adds option to publish (rather than clone) errata into a channel --- spacecmd/src/lib/softwarechannel.py | 25 ++++++++++++++++++++----- 1 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/spacecmd/src/lib/softwarechannel.py b/spacecmd/src/lib/softwarechannel.py index c1c31c2..99ff1e4 100644 --- a/spacecmd/src/lib/softwarechannel.py +++ b/spacecmd/src/lib/softwarechannel.py @@ -1032,8 +1032,10 @@ def do_softwarechannel_removepackages(self, args): def help_softwarechannel_adderratabydate(self): print 'softwarechannel_adderratabydate: Add errata from one channel ' + \ 'into another channel based on a date range' - print 'usage: softwarechannel_adderratabydate SOURCE DEST BEGINDATE ENDDATE' + print 'usage: softwarechannel_adderratabydate [options] SOURCE DEST BEGINDATE ENDDATE' print 'Date format : YYYYMMDD' + print 'Options:' + print ' -p/--publish : Publish errata to the channel (don\'t clone)' def complete_softwarechannel_adderratabydate(self, text, line, beg, end): parts = line.split(' ') @@ -1043,7 +1045,10 @@ def complete_softwarechannel_adderratabydate(self, text, line, beg, end): text) def do_softwarechannel_adderratabydate(self, args): - (args, options) = parse_arguments(args) + + options = [ Option('-p', '--publish', action='store_true') ] + + (args, options) = parse_arguments(args, options) if len(args) != 4: self.help_softwarechannel_adderratabydate() @@ -1076,11 +1081,21 @@ def do_softwarechannel_adderratabydate(self, args): logging.warning('No errata found between the given dates') return - # call adderrata with the list of errata from the date range - return self.do_softwarechannel_adderrata('%s %s %s' % ( + if options.publish: + # Just publish the errata one-by-one, rather than calling + # do_softwarechannel_adderrata which clones the errata + for e in errata: + logging.info("Publishing errata %s to %s" % \ + (e.get('advisory_name'), dest_channel)) + self.client.errata.publish(self.session, e.get('advisory_name'), \ + [dest_channel]) + else: + # call adderrata with the list of errata from the date range + # this clones the errata and adds it to the channel + return self.do_softwarechannel_adderrata('%s %s %s' % ( source_channel, dest_channel, - ' '.join([ e.get('advisory_name') for e in errata ]))) + ' '.join([ e.get('advisory_name') for e in errata ]))) #################### -- 1.7.1 _______________________________________________ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel