def testSync(self): channel_label = "rhel-i386-server-vt-5" rhnSync = RHNSync() report = rhnSync.syncPackages(channel_label, "./%s" % (channel_label), callback=sampleCallBack) print "report = %s" % (report) self.assertTrue(G_STATUS == "FINISHED") self.assertTrue(G_SIZE_LEFT == 0) self.assertTrue(G_ITEMS_LEFT == 0)
def __init__(self): usage = "usage: %prog rhn [OPTIONS]" shortdesc = "Fetches content from a rhn source." desc = "rhn" CliDriver.__init__(self, "rhn", usage, shortdesc, desc) #GrinderLog.setup(self.debug) self.rhnSync = RHNSync() self.parser.add_option( '-a', '--all', action='store_true', help='Fetch ALL packages from a channel, not just latest') self.parser.add_option('-b', '--basepath', action='store', help='Path RPMs are stored') self.parser.add_option('-c', '--certfile', action='store', help='Entitlement Certificate') self.parser.add_option('-C', '--config', action='store', help='Configuration file') self.parser.add_option( '-k', '--kickstarts', action='store_true', help='Sync all kickstart trees for channels specified') self.parser.add_option('-K', '--skippackages', action='store_true', help='Skip sync of packages', default=False) self.parser.add_option( '-L', '--listchannels', action='store_true', help='List all channels we have access to synchronize') self.parser.add_option('-p', '--password', action='store', help='RHN Password') self.parser.add_option('-P', '--parallel', action='store', help='Number of threads to fetch in parallel.') self.parser.add_option('-r', '--removeold', action='store_true', help='Remove older rpms') self.parser.add_option('-s', '--systemid', action='store', help='System ID') self.parser.add_option('-u', '--username', action='store', help='RHN User Account') self.parser.add_option('-U', '--url', action='store', help='Red Hat Server URL') self.parser.add_option("--limit", dest="limit", help="Limit bandwidth in KB/sec", default=None)