예제 #1
0
def login(systemId=None):
    server = rpcServer.getServer()
    log = up2dateLog.initLog()

    # send up the capabality info
    headerlist = clientCaps.caps.headerFormat()
    for (headerName, value) in headerlist:
        server.add_header(headerName, value)

    if systemId == None:
        systemId = getSystemId()

    if not systemId:
        return None

    maybeUpdateVersion()
    log.log_me("logging into up2date server")

    # the list of caps the client needs
    caps = capabilities.Capabilities()

    global loginInfo
    try:
        li = rpcServer.doCall(server.up2date.login, systemId)
    except rpclib.Fault, f:
        if abs(f.faultCode) == 49:
            #            print f.faultString
            raise up2dateErrors.AbuseError(f.faultString)
        else:
            raise f
예제 #2
0
def login(systemId=None):
    server = rpcServer.getServer()
    log = rhnLog.initLog()

    # send up the capabality info
    headerlist = clientCaps.caps.headerFormat()
    for (headerName, value) in headerlist:
        server.add_header(headerName, value)

    if systemId == None:
        systemId = getSystemId()

    if not systemId:
        return None

    maybeUpdateVersion()
    log.log_me("logging into up2date server")

    # the list of caps the client needs
    caps = capabilities.Capabilities()

    global loginInfo, loginTime, loginOffset
    try:
        loginInfo = rpcServer.doCall(server.up2date.login, systemId)
        loginTime = time.time()
        loginOffset = float(loginInfo['X-RHN-Auth-Expire-Offset']) - 60.0
    except xmlrpclib.Fault, f:
        if abs(f.faultCode) == 49:
            #            print f.faultString
            raise rhnErrors.AbuseError(f.faultString)
        else:
            raise f
예제 #3
0
파일: manager.py 프로젝트: aaronad/ncclient
def connect_ssh(*args, **kwds):
    """Initialize a :class:`Manager` over the SSH transport. For documentation of arguments see :meth:`ncclient.transport.SSHSession.connect`.

    The underlying :class:`ncclient.transport.SSHSession` is created with :data:`CAPABILITIES`. It is first instructed to :meth:`~ncclient.transport.SSHSession.load_known_hosts` and then  all the provided arguments are passed directly to its implementation of :meth:`~ncclient.transport.SSHSession.connect`.
    """
    session = transport.SSHSession(capabilities.Capabilities(CAPABILITIES))
    session.load_known_hosts()
    session.connect(*args, **kwds)
    return Manager(session)
예제 #4
0
파일: rhnserver.py 프로젝트: ncounter/uyuni
 def __get_capabilities(self):
     if self._capabilities is None:
         headers = self._server.get_response_headers()
         if headers is None:
             self.registration.welcome_message()
             headers = self._server.get_response_headers()
         self._capabilities = capabilities.Capabilities()
         self._capabilities.populate(headers)
     return self._capabilities
예제 #5
0
        else:
            raise rhnErrors.CommunicationError(f.faultString)


def getCaps():
    s = rpcServer.getServer()

    try:
        rpcServer.doCall(s.registration.welcome_message)
    except xmlrpclib.Fault, f:
        if f.faultCode == 99:
            raise rhnErrors.DelayError(f.faultString)
        else:
            raise f

    caps = capabilities.Capabilities()
    response_headers = s.get_response_headers()
    caps.populate(response_headers)

    # figure out if were missing any needed caps
    caps.validate()


def termsAndConditions():
    s = rpcServer.getServer()

    try:
        return rpcServer.doCall(s.registration.terms_and_conditions)
    except xmlrpclib.Fault, f:
        if f.faultCode == 99:
            raise rhnErrors.DelayError(f.faultString)
예제 #6
0
def connect_stdio(*args, **kwargs):
    """Create a subprocess with a NETCONF server, takes
    """
    session = transport.StdIOSession(capabilities.Capabilities(CAPABILITIES))
    session.connect(*args, **kwargs)
    return Manager(session)