hello
where can i find this working script rhn-clone-errata? i am also looking for cloning packages. Does any body has a script for this. Thanks. That is what I needed. > > > > ----- Original Message ---- > From: "Knigga, Kris D" <[email protected]> > To: [email protected] > Sent: Wed, April 21, 2010 9:01:02 AM > Subject: Re: [Spacewalk-list] rhn-clone-errata.py thru a squid proxy > > Here is the diff of Andy's script version 0.4 and my modifications to it. > My modifications do away with the splitting of errata based on channel and > add support for HTTP proxies. Or at least, it works with /my/ proxy. > YMMV. > > > ##### Begin diff ##### > > > *** rhn-clone-errata.py 2010-01-18 16:25:31.000000000 -0600 > --- rhn-clone-errata-playground.py 2010-02-11 16:27:23.000000000 -0600 > *************** > *** 51,56 **** > --- 51,58 ---- > # intermittent time-outs doing the two together in the > errata.create() > # function. > > + import rhn.rpclib > + import rhn.transports > import xmlrpclib > from optparse import OptionParser > from time import time, localtime, strftime > *************** > *** 60,73 **** > import re > > class RHNServer: > ! def __init__(self,servername,user,passwd): > self.rhnServerName = servername > self.login = user > self.password = passwd > self.rhnUrl = 'https://'+self.rhnServerName+'/rpc/api' > ! self.server = xmlrpclib.Server(self.rhnUrl) > self.rhnSession = self.rhnLogin(self.login,self.password,0) > > def rhnLogin(self, login, password, retry): > try: > rhnSession=self.server.auth.login(login,password) > --- 62,83 ---- > import re > > class RHNServer: > ! def __init__(self,servername,user,passwd,proxy): > self.rhnServerName = servername > self.login = user > self.password = passwd > + self.proxy = proxy > self.rhnUrl = 'https://'+self.rhnServerName+'/rpc/api' > ! if self.proxy == None: > ! self.server = rhn.rpclib.Server(self.rhnUrl) > ! else: > ! self.server = rhn.rpclib.Server(self.rhnUrl, > transport=rhn.transports.SafeProxyTransport(self.proxy)) > ! self.server.allow_redirect(1) > self.rhnSession = self.rhnLogin(self.login,self.password,0) > > + def __del__(self): > + self.rhnLogout() > + > def rhnLogin(self, login, password, retry): > try: > rhnSession=self.server.auth.login(login,password) > *************** > *** 88,97 **** > return self.rhnLogin(login,password, (retry + 1)) > return rhnSession > > def getErrataChannels(self,advisory,retry): > channels = [] > try: > ! details = > self.server.errata.applicableToChannels(self.rhnSession,advisory) > except xmlrpclib.Fault, f: > if options.verbose: > print "Fault Code: %d\tFault String: %s" % > (f.faultCode,f.faultString) > --- 98,111 ---- > return self.rhnLogin(login,password, (retry + 1)) > return rhnSession > > + def rhnLogout(self): > + self.server.auth.logout(self.rhnSession) > + return > + > def getErrataChannels(self,advisory,retry): > channels = [] > try: > ! channels = > self.server.errata.applicableToChannels(self.rhnSession,advisory) > except xmlrpclib.Fault, f: > if options.verbose: > print "Fault Code: %d\tFault String: %s" % > (f.faultCode,f.faultString) > *************** > *** 420,426 **** > > def main(): > global chanMap > - global chanSuffixMap > global RHNServer > global RHNUser > global RHNPass > --- 434,439 ---- > *************** > *** 441,446 **** > --- 454,461 ---- > userRHN = 'rhnuser' > passRHN = 'rhnpass' > > + proxy = '192.168.50.26:8080' > + > # Here we setup our mappings from RHN to Local software channels. > # Set these to what you have created for your SPW. > # They are paired as: > *************** > *** 458,498 **** > 'rhn-tools-rhel-4-as-i386': > 'rhel-4-as-i386-tools' > }; > > - # Here we also setup mappings from RHN channels to errata suffixes. > - # Since we can't easily publish automagically, while ensuring that > - # the right packages go into the right channels, we're going to > - # split multi-channel affecting errata into individual errata > - # that are suffixed with something meaningful that identifies > - # each sub-errata per channel... blah blah... Of course, modify this > - # as you will. > - # > - # RHNChannel: ErrataSuffix > - # > - chanSuffixMap = { > - 'rhel-x86_64-server-5': 'R5-64', > - 'rhn-tools-rhel-x86_64-server-5': 'R5-64-T', > - 'rhel-x86_64-server-productivity-5': 'R5-64-P', > - 'rhel-x86_64-server-supplementary-5': 'R5-64-S', > - 'rhel-x86_64-server-vt-5': 'R5-64-V', > - 'rhel-i386-server-5': 'R5-32', > - 'rhn-tools-rhel-i386-server-5': 'R5-32-T', > - 'rhel-i386-server-productivity-5': 'R5-32-P', > - 'rhel-i386-server-supplementary-5': 'R5-32-S', > - 'rhel-i386-server-vt-5': 'R5-32-V', > - 'rhel-x86_64-as-4': 'R4-64', > - 'rhel-x86_64-as-4-extras': 'R4-64-E', > - 'rhn-tools-rhel-4-as-x86_64': 'R4-64-T', > - 'rhel-i386-as-4': 'R4-32', > - 'rhel-i386-as-4-extras': 'R4-32-E', > - 'rhn-tools-rhel-4-as-i386': 'R4-32-T' > - }; > - > if chanMap[options.src_channel] is None: > print "Invalid Channel!" > sys.exit(2) > > ! myRHN = RHNServer(svrRHN,userRHN,passRHN) > ! mySPW = SPWServer(options.src_server,options.login,options.passwd) > > dateStart = options.bdate or '19000101' > dateEnd = options.edate or strftime("%Y%m%d", localtime()) > --- 473,484 ---- > 'rhn-tools-rhel-4-as-i386': 'rhel-4-as-i386-tools' > }; > > if chanMap[options.src_channel] is None: > print "Invalid Channel!" > sys.exit(2) > > ! myRHN = RHNServer(svrRHN,userRHN,passRHN,proxy) > ! mySPW = > SPWServer(options.src_server,options.login,options.passwd,None) > > dateStart = options.bdate or '19000101' > dateEnd = options.edate or strftime("%Y%m%d", localtime()) > *************** > *** 506,512 **** > print rhnErrata['errata_advisory'] > > # Now, let's check if we already have this errata locally... > ! spwErrataName = > rhnErrata['errata_advisory']+':'+chanSuffixMap[options.src_channel] > spwErrCheck = mySPW.getErrataDetails (spwErrataName,0) > > if not spwErrCheck: > --- 492,498 ---- > print rhnErrata['errata_advisory'] > > # Now, let's check if we already have this errata locally... > ! spwErrataName = rhnErrata['errata_advisory'] > spwErrCheck = mySPW.getErrataDetails (spwErrataName,0) > > if not spwErrCheck: > *************** > *** 524,532 **** > 0) > > for pkgChan in pkg['providing_channels']: > ! if pkgChan != options.src_channel: > ! continue > ! else: > if not pkgFind: > print "Hmmm... Package Missing: %s" % > pkg['package_name'] > else: > --- 510,516 ---- > 0) > > for pkgChan in pkg['providing_channels']: > ! if pkgChan in chanMap: > if not pkgFind: > print "Hmmm... Package Missing: %s" % > pkg['package_name'] > else: > *************** > *** 565,571 **** > print "\tErrata Created: %d" % spwErrObject['id'] > > if options.publish: > ! spwPublish = mySPW.errataPublish (spwErrataName, > [chanMap[options.src_channel]], 0) > print "\tErrata Published!" > else: > print "\t Errata Not Published!" > --- 549,559 ---- > print "\tErrata Created: %d" % spwErrObject['id'] > > if options.publish: > ! applicable_channels = [] > ! for chan in myRHN.getErrataChannels(spwErrataName,0): > ! if chan['channel_label'] in chanMap: > ! > applicable_channels.append(chanMap[chan['channel_label']]) > ! spwPublish = mySPW.errataPublish (spwErrataName, > applicable_channels, 0) > print "\tErrata Published!" > else: > print "\t Errata Not Published!" > > > > > ##### End diff ##### > > > > Kris Knigga > [email protected] <--- New email address! > > -----Original Message----- > Date: Wed, 21 Apr 2010 05:48:30 -0700 (PDT) > From: Eric <[email protected]> > To: Colin Coe <[email protected]>, [email protected] > Subject: Re: [Spacewalk-list] rhn-clone-errata.py thru a squid proxy > Message-ID: <[email protected]> > Content-Type: text/plain; charset="us-ascii" > > Thanks for the quick response Colin. > > If I specify: > /usr/local/sbin/rhn-clone-errata.py -s spacewalk.local -l swadmin -p > secret -x webprox1:3128 -v -u -c rhel-i386-server-5 > > I receive the error > rhn-clone-errata.py: error: no such option: -x > > To clarify, I am using Andy Speagle's script, which I believe is the > latest one. > > Thanks, > > -Eric > > > _____________ > > The information contained in this message is proprietary and/or > confidential. If you are not the intended recipient, please: (i) delete > the message and all copies; (ii) do not disclose, distribute or use the > message in any manner; and (iii) notify the sender immediately. In > addition, please be aware that any message addressed to our domain is > subject to archiving and review by persons other than the intended > recipient. Thank you. > _____________ > > _______________________________________________ > Spacewalk-list mailing list > [email protected] > https://www.redhat.com/mailman/listinfo/spacewalk-list > > > > > > _______________________________________________ > Spacewalk-list mailing list > [email protected] > https://www.redhat.com/mailman/listinfo/spacewalk-list > _______________________________________________ Spacewalk-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/spacewalk-list
