コード例 #1
0
ファイル: testRpcServer.py プロジェクト: m47ik/uyuni
 def testGetServerRedirectServer(self):
     "Verify that getServer works when talking to a server that redirects"
     self.cfg['serverURL'] = "%s-REDIRECT" % self.cfg['serverURL']
     try:
         s = rpcServer.getServer()
     except:
         self.fail("Got an expection calling rpcServer.getServer")
コード例 #2
0
ファイル: testRpcServer.py プロジェクト: m47ik/uyuni
 def testDefaultWelcomeMessageHttpsToHttpsCheckReturnCode(self):
     "Test redirecting https to https and verify its return code"
     self.cfg['serverURL'] = "%s/XMLRPC-REDIRECT" % self.defaultServer
     s = rpcServer.getServer()
     s.registration.welcome_message()
     status  = s.get_response_status()
     self.assertEqual(status, 200)
コード例 #3
0
ファイル: testRpcServer.py プロジェクト: ncounter/uyuni
 def testDefaulWelcomeMessageNoRedirectCheckRedirect(self):
     "Test a non redirecting connection and see if redirected() is set"
     self.cfg['serverURL'] = "http://SECRET_URL/XMLRPC"
     s = rpcServer.getServer()
     s.registration.welcome_message()
     ret = s.redirected()
     self.assertEqual(ret, None)
コード例 #4
0
ファイル: testRpcServer.py プロジェクト: ncounter/uyuni
 def testGetServerRedirectServer(self):
     "Verify that getServer works when talking to a server that redirects"
     self.cfg['serverURL'] = "https://rhn.redhat.com/XMLRPC-REDIRECT"
     try:
         s = rpcServer.getServer()
     except:
         self.fail("Got an expection calling rpcServer.getServer")
コード例 #5
0
def updateHardware():
    s = rpcServer.getServer()


    hardwareList = hardware.Hardware()
    s.registration.refresh_hw_profile(up2dateAuth.getSystemId(),
                                          hardwareList)
コード例 #6
0
ファイル: rhnserver.py プロジェクト: xkollar/spacewalk
 def __init__(self, serverOverride=None, timeout=None, rpcServerOverride=None):
     if rpcServerOverride is None:
         self._server = rpcServer.getServer(serverOverride=serverOverride,
                 timeout=timeout)
     else:
         self._server = rpcServerOverride
     self._capabilities = None
コード例 #7
0
 def testDefaultWelcomeMessageHttpToHttpsCheckRedirect(self):
     "Test redirecting http to https and verify redirect()"
     self.cfg['serverURL'] = "%s/XMLRPC-REDIRECT" % self.defaultServer
     s = rpcServer.getServer()
     s.registration.welcome_message()
     ret = s.redirected()
     self.assertEqual(ret, "%s/XMLRPC") % self.defaultServer
コード例 #8
0
 def testGetServerRedirectServer(self):
     "Verify that getServer works when talking to a server that redirects"
     self.cfg['serverURL'] = "%s-REDIRECT" % self.cfg['serverURL']
     try:
         s = rpcServer.getServer()
     except:
         self.fail("Got an expection calling rpcServer.getServer")
コード例 #9
0
 def testDefaultWelcomeMessageHttpsToHttpsCheckReturnCode(self):
     "Test redirecting https to https and verify its return code"
     self.cfg['serverURL'] = "%s/XMLRPC-REDIRECT" % self.defaultServer
     s = rpcServer.getServer()
     s.registration.welcome_message()
     status = s.get_response_status()
     self.assertEqual(status, 200)
コード例 #10
0
ファイル: testRpcServer.py プロジェクト: ncounter/uyuni
 def testDefaultWelcomeMessageHttpToHttpCheckRedirect(self):
     "Test redirecting http to http and verify redirect()"
     self.cfg['serverURL'] = "http://SECRET_URL/XMLRPC-REDIRECT-NOSSL"
     s = rpcServer.getServer()
     s.registration.welcome_message()
     ret = s.redirected()
     self.assertEqual(ret, "http://SECRET_URL/XMLRPC")
コード例 #11
0
 def testDefaultWelcomeMessageFailoverNonExistentServer(self):
     "Test welcome_message call faling over from a non existent server"
     self.cfg['serverURL'] = [
         self.neServer, '%s/XMLRPC' % self.defaultServer
     ]
     s = rpcServer.getServer()
     s.registration.welcome_message()
コード例 #12
0
ファイル: testRpcServer.py プロジェクト: m47ik/uyuni
 def testDefaultWelcomeMessageHttpToHttpsCheckRedirect(self):
     "Test redirecting http to https and verify redirect()"
     self.cfg['serverURL'] = "%s/XMLRPC-REDIRECT" % self.defaultServer
     s = rpcServer.getServer()
     s.registration.welcome_message()
     ret = s.redirected()
     self.assertEqual(ret, "%s/XMLRPC") % self.defaultServer
コード例 #13
0
ファイル: testRpcServer.py プロジェクト: ncounter/uyuni
 def testDefaultWelcomeMessageHttpToHttpCheckReturnCode(self):
     "Test redirecting http to http and verify its return code"
     self.cfg['serverURL'] = "http://SECRET_URL/XMLRPC-REDIRECT-NOSSL"
     s = rpcServer.getServer()
     s.registration.welcome_message()
     status = s.get_response_status()
     self.assertEqual(status, 200)
コード例 #14
0
 def testDefaultWelcomeMessageFailover404ServerRedirect(self):
     "Test welcome_message call faling over from a non existent server to a redirect"
     self.cfg['serverURL'] = [
         self.FourOhFourServer,
         '%s/XMLRPC-REDIRECT' % self.defaultServer
     ]
     s = rpcServer.getServer()
     s.registration.welcome_message()
コード例 #15
0
 def testDefaultWelcomeMessageFailover404Server(self):
     "Test welcome_message call faling over from a server that 404's"
     self.cfg['serverURL'] = [
         self.FourOhFourServer,
         '%s/XMLRPC' % self.defaultServer
     ]
     s = rpcServer.getServer()
     s.registration.welcome_message()
コード例 #16
0
ファイル: testRpcServer.py プロジェクト: ncounter/uyuni
    def testGetServerMultipleCaCert(self):
        "getServer with a multiple CA certs"
        rpcServer.rhns_ca_certs = ["/usr/share/rhn/RHNS-CA-CERT", "/usr/share/rhn/RHNS-CA-CERT"]

        try:
            s = rpcServer.getServer()
        except:
            self.fail("Got an %s expection" % sys.exc_type)
コード例 #17
0
ファイル: testRpcServer.py プロジェクト: ncounter/uyuni
 def testGetServerAuthProxyNoEnableAuthProxy(self):
     "getServer with httpProxy set, but no enableAuthProxy"
     sys.path.append("/etc/sysconfig/rhn/")
     proxyUrl = testConfig.authProxyUrl
     self.cfg['httpProxy'] = testConfig.authProxyUrl
     try:
         s = rpcServer.getServer()
     except:
         self.fail("Got an expection calling rpcServer.getServer")
コード例 #18
0
ファイル: testRpcServer.py プロジェクト: ncounter/uyuni
 def testGetServerProxy(self):
     "Verify that getServer Works when specifying a proxy"
     sys.path.append("/etc/sysconfig/rhn/")
     proxyUrl = testConfig.anonProxyUrl
     self.cfg['httpProxy'] = proxyUrl
     try:
         s = rpcServer.getServer()
     except:
         self.fail("Got an expection calling rpcServer.getServer")
コード例 #19
0
ファイル: testRpcServer.py プロジェクト: ncounter/uyuni
 def testGetServerAuthProxyNoUsername(self):
     "Verify that getSerer works when specifying an an auth proxy and no username"
     sys.path.append("/etc/sysconfig/rhn/")
     proxyUrl = testConfig.authProxyUrl
     self.cfg['httpProxy'] = testConfig.authProxyUrl
     self.cfg['enableAuthProxy'] = 1
     try:
         s = rpcServer.getServer()
     except:
         self.fail("Got an expection calling rpcServer.getServer")
コード例 #20
0
 def testGetServerNoCaCert(self):
     "getServer with a missing CA cert"
     self.cfg['sslCACert'] = ["/var/not/likely/to/exist/I/hope/SSL-CA-Cert"]
     try:
         s = rpcServer.getServer()
         write(s)
     except SystemExit:
         pass
     else:
         self.fail("Expected to get an SSLCertificateFileNotFound error")
コード例 #21
0
ファイル: testRpcServer.py プロジェクト: ncounter/uyuni
 def testDefaultWelcomeMessageHttpsToHttp(self):
     "Test redirecting https to http"
     self.cfg['serverURL'] = "https://SECRET_URL/XMLRPC-REDIRECT-NOSSL"
     s = rpcServer.getServer()
     try:
         s.registration.welcome_message()
     except rpclib.InvalidRedirectionError:
         pass
     else:
         self.fail("IOError expected here but didnt get it")
コード例 #22
0
ファイル: testRpcServer.py プロジェクト: m47ik/uyuni
 def testGetServerNoCaCert(self):
     "getServer with a missing CA cert"
     self.cfg['sslCACert'] =  ["/var/not/likely/to/exist/I/hope/SSL-CA-Cert"]
     try:
         s = rpcServer.getServer()
         write(s)
     except SystemExit:
         pass
     else:
         self.fail("Expected to get an SSLCertificateFileNotFound error")
コード例 #23
0
 def testDefaultWelcomeMessageHttpsToHttpsRedirectsOff(self):
     "Test redirecting https to https and verify it fails with allow_redirect off"
     self.cfg['serverURL'] = "%s/XMLRPC-REDIRECT" % self.defaultServer
     s = rpcServer.getServer()
     s.allow_redirect(0)
     try:
         s.registration.welcome_message()
     except rpclib.InvalidRedirectionError:
         pass
     else:
         self.fail("InvalidRedirectionError expected here but didnt get it")
コード例 #24
0
ファイル: testRpcServer.py プロジェクト: ncounter/uyuni
    def testGetServerNoCaCert(self):
        "getServer with a missing CA cert"
        self.cfg['sslCACert'] =  ["/var/not/likely/to/exist/I/hope/SSL-CA-Cert"]
#        rpcServer.rhns_ca_certs = ["/var/not/likely/to/exist/I/hope/SSL-CA-Cert"]
        try:
            s = rpcServer.getServer()
            write(s)
        except SystemExit:
            pass
        else:
            self.fail("Expected to get a sys.exit(1)")
コード例 #25
0
ファイル: testRpcServer.py プロジェクト: m47ik/uyuni
 def testDefaultWelcomeMessageHttpsToHttpsRedirectsOff(self):
     "Test redirecting https to https and verify it fails with allow_redirect off"
     self.cfg['serverURL'] = "%s/XMLRPC-REDIRECT" % self.defaultServer
     s = rpcServer.getServer()
     s.allow_redirect(0)
     try:
         s.registration.welcome_message()
     except  rpclib.InvalidRedirectionError:
         pass
     else:
         self.fail("InvalidRedirectionError expected here but didnt get it")
コード例 #26
0
    def testGetServerMultipleCaCert(self):
        "getServer with a multiple CA certs"
        rpcServer.rhns_ca_certs = [
            "/etc/ssl/certs/ISRG_Root_X1.pem",
            "/etc/ssl/certs/ISRG_Root_X1.pem"
        ]

        try:
            s = rpcServer.getServer()
        except:
            self.fail("Got an %s exception" % sys.exc_type)
コード例 #27
0
ファイル: testRpcServer.py プロジェクト: ncounter/uyuni
 def testDefaultWelcomeMessageHttpToHttpRedirectsOff(self):
     "Test redirecting http to http and verify if tails with allow_redirect off"
     self.cfg['serverURL'] = "http://SECRET_URL/XMLRPC-REDIRECT-NOSSL"
     s = rpcServer.getServer()
     s.allow_redirect(0)
     try:
         s.registration.welcome_message()
     except rpclib.InvalidRedirectionError:
         pass
     else:
         self.fail("InvalidRedirectionError expected here but didnt get it")
コード例 #28
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)
コード例 #29
0
    def __get_server():
        """ Initialize a server connection and set up capability info. """
        server = rpcServer.getServer()

        # load the new client caps if they exist
        clientCaps.loadLocalCaps()

        headerlist = clientCaps.caps.headerFormat()
        for (headerName, value) in headerlist:
            server.add_header(headerName, value)

        return server
コード例 #30
0
ファイル: up2dateRepo.py プロジェクト: ChrisPortman/mrepo
 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)
コード例 #31
0
ファイル: rhn_check.py プロジェクト: BlackSmith/spacewalk
    def __get_server():
        """ Initialize a server connection and set up capability info. """
        server = rpcServer.getServer()

        # load the new client caps if they exist
        clientCaps.loadLocalCaps()

        headerlist = clientCaps.caps.headerFormat()
        for (headerName, value) in headerlist:
            server.add_header(headerName, value)

        return server
コード例 #32
0
ファイル: testRpcServer.py プロジェクト: ncounter/uyuni
 def testDefaultWelcomeMessageHttpsToHttpCheckRedirect(self):
     "Test redirecting https to http and verify redirect()"
     self.cfg['serverURL'] = "https://SECRET_URL/XMLRPC-REDIRECT-NOSSL"
     s = rpcServer.getServer()
     try:
         s.registration.welcome_message()
     except rpclib.InvalidRedirectionError:
         pass
     else:
         self.fail("InvalidRedirectError expected here but didnt get it")
     ret = s.redirected()
     self.assertEqual(ret, "http://SECRET_URL/XMLRPC")
コード例 #33
0
ファイル: testRpcServer.py プロジェクト: ncounter/uyuni
    def testDefaultWelcomeMessageHttpsToHttpFailoversSSL(self):
        "Test redirecting https to http after failing over from bad ssl servers"
        self.cfg['serverURL'] = [self.neServerSSL,
                                 self.FourOhFourServerSSL,
                                 "https://SECRET_URL/XMLRPC-REDIRECT-NOSSL"]
        s = rpcServer.getServer()

        try:
            s.registration.welcome_message()
        except rpclib.InvalidRedirectionError:

            pass
        else:
            self.fail("InvalidRedirectionError expected here but didnt get it")
コード例 #34
0
def refresh_list(cache_only=None):
    if cache_only:
        return (0, "no-ops for caching", {})

    # read all hardware in
    hardwareList = hardware.Hardware()

    s = rpcServer.getServer()

    if argVerbose > 1:
        print "Called refresh_hardware"

    try:
        s.registration.refresh_hw_profile(up2dateAuth.getSystemId(),
                                          hardwareList)
    except:
        print "ERROR: sending hardware database for System Profile"
        return (12, "Error refreshing system hardware", {})

    return (0, "hardware list refreshed", {})
コード例 #35
0
ファイル: hardware.py プロジェクト: bjmingyang/spacewalk
def refresh_list(cache_only=None):
    if cache_only:
        return (0, "no-ops for caching", {})

    # read all hardware in
    hardwareList = hardware.Hardware()

    s = rpcServer.getServer()

    if argVerbose > 1:
        print "Called refresh_hardware"

    try:
        s.registration.refresh_hw_profile(up2dateAuth.getSystemId(),
                                          hardwareList)
    except:
        print "ERROR: sending hardware database for System Profile"
        return (12, "Error refreshing system hardware", {})

    return (0, "hardware list refreshed", {})
コード例 #36
0
ファイル: testRpcServer.py プロジェクト: BlackSmith/spacewalk
 def testDefaultWelcomeMessage(self):
     "Test welcome_message call with no redirects or proxies"
     s = rpcServer.getServer()
     s.registration.welcome_message()
コード例 #37
0
ファイル: testRpcServer.py プロジェクト: ncounter/uyuni
 def testGetServerDefaultWithRefreshCallback(self):
     "Verify that getServer works with default config and a refreshCallback"
     try:
         s = rpcServer.getServer(refreshCallback=self.__callback)
     except:
         self.fail("Got an expection calling rpcServer.getServer")
コード例 #38
0
ファイル: testRpcServer.py プロジェクト: BlackSmith/spacewalk
 def testDefaultWelcomeMessageFailoverNonExistentServer(self):
     "Test welcome_message call faling over from a non existent server"
     self.cfg['serverURL'] = [ self.neServer,
                              'https://SECRET_URL/XMLRPC']
     s = rpcServer.getServer()
     s.registration.welcome_message()
コード例 #39
0
ファイル: testRpcServer.py プロジェクト: ncounter/uyuni
 def testDefaultWelcomeMessageHttpsToHttps(self):
     "Test redirecting https to https"
     self.cfg['serverURL'] = "https://SECRET_URL/XMLRPC-REDIRECT"
     s = rpcServer.getServer()
     s.registration.welcome_message()
コード例 #40
0
ファイル: testRpcServer.py プロジェクト: BlackSmith/spacewalk
 def testDefaultWelcomeMessageFailover404Server(self):
     "Test welcome_message call faling over from a server that 404's"
     self.cfg['serverURL'] = [ self.FourOhFourServer,
                               'https://SECRET_URL/XMLRPC']
     s = rpcServer.getServer()
     s.registration.welcome_message()
コード例 #41
0
ファイル: testRpcServer.py プロジェクト: ncounter/uyuni
 def testGetServerDefault(self):
     "Verify that rpcServer.getServer works with default config and arguments"
     try:
         s = rpcServer.getServer()
     except:
         self.fail("Got an expection calling rpcServer.getServer")
コード例 #42
0
ファイル: testRpcServer.py プロジェクト: BlackSmith/spacewalk
 def testDefaultWelcomeMessageFailover404ServerRedirect(self):
     "Test welcome_message call faling over from a non existent server to a redirect"
     self.cfg['serverURL'] = [ self.FourOhFourServer,
                              'https://SECRET_URL/XMLRPC-REDIRECT']
     s = rpcServer.getServer()
     s.registration.welcome_message()