Exemplo n.º 1
0
    def __call__(self, *args, **kwargs):
        """ Call the method. Catch faults and translate them. """
        method = getattr(self._server, self._method_name)

        try:
            return rpcServer.doCall(method, *args, **kwargs)
        except xmlrpclib.Fault:
            raise_with_tb(self.__exception_from_fault(sys.exc_info()[1]))
        except OpenSSL.SSL.Error:
            # TODO This should probably be moved to rhnlib and raise an
            # exception that subclasses OpenSSL.SSL.Error
            # TODO Is there a better way to detect cert failures?
            error = str(sys.exc_info()[1])
            error = error.strip("[()]")
            pieces = error.split(',')
            message = ""
            if len(pieces) > 2:
                message = pieces[2]
            elif len(pieces) == 2:
                message = pieces[1]
            message = message.strip(" '")
            if message == 'certificate verify failed':
                raise_with_tb(up2dateErrors.SSLCertificateVerifyFailedError())
            else:
                raise_with_tb(up2dateErrors.NetworkError(message))
Exemplo n.º 2
0
 def getHeader(self, pkg, msgCallback=None, progressCallback=None):
     self.repos = repoDirector.initRepoDirector()
     hdr, type = rpcServer.doCall(self.repos.getHeader,
                                  pkg,
                                  msgCallback=msgCallback,
                                  progressCallback=progressCallback)
     return hdr
Exemplo n.º 3
0
 def getHeader(self, pkg,
               msgCallback = None,
               progressCallback = None ):
     self.repos = repoDirector.initRepoDirector()
     hdr, type = rpcServer.doCall(self.repos.getHeader, pkg,
                                  msgCallback = msgCallback,
                                  progressCallback = progressCallback)
     return hdr
Exemplo n.º 4
0
 def getSolutions(self, unknowns, progressCallback=None, msgCallback=None):
     s = rpcServer.getServer(refreshCallback=self.refreshCallback)
     try:
         tmpRetList = rpcServer.doCall(s.up2date.solveDependencies,
                                       up2dateAuth.getSystemId(), unknowns)
     except rpclib.Fault, f:
         if f.faultCode == -26:
             #raise RpmError(f.faultString + _(", depended on by %s") % unknowns)
             raise up2dateErrors.RpmError(f.faultString)
         else:
             raise up2dateErrors.CommunicationError(f.faultString)
Exemplo n.º 5
0
 def getSolutions(self, unknowns, progressCallback = None, msgCallback = None):
     s = rpcServer.getServer(refreshCallback=self.refreshCallback)
     try:
         tmpRetList = rpcServer.doCall(s.up2date.solveDependencies,
                                         up2dateAuth.getSystemId(),
                                         unknowns)
     except rpclib.Fault, f:
         if f.faultCode == -26:
             #raise RpmError(f.faultString + _(", depended on by %s") % unknowns)
             raise up2dateErrors.RpmError(f.faultString)
         else:
              raise up2dateErrors.CommunicationError(f.faultString)
Exemplo n.º 6
0
for channel in rhnChannel.getChannels(force=1).list: print channel['label'],
print

for channel in repos.channels.list: print channel['label'],
print

for channel in subscribedChannels(): print channel['label'],
print
#sys.exit(0)

debugprint(up2dateAuth.getLoginInfo())

for channel in subscribedChannels():
    cfg['storageDir'] = '/var/yam/rhel4as-i386/'+channel['label']
    try: os.makedirs(cfg['storageDir'], 0755)
    except: pass
    print channel['label'], channel['type'], channel['url'], channel['version']
    package_list, type = rpcServer.doCall(repos.listPackages, channel, None, None)
    print channel['label'], 'has', len(package_list), 'packages'
#   for name, version, release, test, arch, test, label in package_list:
#       print name,
#   for pkg in package_list:
#       name, version, release, test, arch, test, label = pkg
#       rpcServer.doCall(repos.getPackage, pkg)
#       rpcServer.doCall(repos.getPackage, pkg, wrapperUtils.printPkg, wrapperUtils.printRetrieveHash)

### Print packages
#printList(rhnPackageInfo.getAvailableAllArchPackageList(), cfg['showChannels'])
#print rhnPackageInfo.getAvailableAllArchPackageList()
Exemplo n.º 7
0
    print channel['label'],
print

for channel in subscribedChannels():
    print channel['label'],
print
#sys.exit(0)

debugprint(up2dateAuth.getLoginInfo())

for channel in subscribedChannels():
    cfg['storageDir'] = '/var/yam/rhel4as-i386/' + channel['label']
    try:
        os.makedirs(cfg['storageDir'], 0755)
    except:
        pass
    print channel['label'], channel['type'], channel['url'], channel['version']
    package_list, type = rpcServer.doCall(repos.listPackages, channel, None,
                                          None)
    print channel['label'], 'has', len(package_list), 'packages'
#   for name, version, release, test, arch, test, label in package_list:
#       print name,
#   for pkg in package_list:
#       name, version, release, test, arch, test, label = pkg
#       rpcServer.doCall(repos.getPackage, pkg)
#       rpcServer.doCall(repos.getPackage, pkg, wrapperUtils.printPkg, wrapperUtils.printRetrieveHash)

### Print packages
#printList(rhnPackageInfo.getAvailableAllArchPackageList(), cfg['showChannels'])
#print rhnPackageInfo.getAvailableAllArchPackageList()