Beispiel #1
0
def sendHardware(systemId, hardwareList):
    s = rpcServer.getServer()

    try:
        rpcServer.doCall(s.registration.add_hw_profile, systemId, hardwareList)
    except xmlrpclib.Fault, f:
        if f.faultCode == 99:
            raise rhnErrors.DelayError(f.faultString)
        else:
            raise rhnErrors.CommunicationError(f.faultString)
Beispiel #2
0
def listPackages(systemId):
    s = rpcServer.getServer()

    try:
        rpcServer.doCall(s.registration.list_packages, systemId)
    except xmlrpclib.Fault, f:
        if f.faultCode == 99:
            raise rhnErrors.DelayError(f.faultString)
        else:
            raise rhnErrors.CommunicationError(f.faultString)
Beispiel #3
0
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)
        else:
            raise rhnErrors.CommunicationError(f.faultString)
Beispiel #4
0
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
Beispiel #5
0
def privacyText():
    s = rpcServer.getServer()

    try:
        return rpcServer.doCall(s.registration.privacy_statement)
    except xmlrpclib.Fault, f:
        if f.faultCode == 99:
            raise rhnErrors.DelayError(f.faultString)
        else:
            raise rhnErrors.CommunicationError(f.faultString)
Beispiel #6
0
def welcomeText():
    s = rpcServer.getServer()

    try:
        return rpcServer.doCall(s.registration.welcome_message)
    except xmlrpclib.Fault, f:
        if f.faultCode == 99:
            raise rhnErrors.DelayError(f.faultString)
        else:
            raise rhnErrors.CommunicationError(f.faultString)
Beispiel #7
0
def registerProduct(systemId, productInfo):
    s = rpcServer.getServer()

    try:
        rpcServer.doCall(s.registration.register_product, systemId,
                         productInfo)
    except xmlrpclib.Fault, f:
        if f.faultCode == 99:
            raise rhnErrors.DelayError(f.faultString)
        else:
            raise rhnErrors.CommunicationError(f.faultString)
Beispiel #8
0
def validateRegNum(regNum):
    s = rpcServer.getServer()

    try:
        rpcServer.doCall(s.registration.validate_reg_num, regNum)
    except xmlrpclib.Fault, f:
        if f.faultCode == -16:
            # invalid
            raise rhnErrors.ValidationError(f.faultString)
        elif f.faultCode == 99:
            raise rhnErrors.DelayError(f.faultString)
        else:
            raise rhnErrors.CommunicationError(f.faultString)
Beispiel #9
0
def sendSerialNumber(systemId, num):
    s = rpcServer.getServer()

    try:
        if cfg["oemId"] != None:
            rpcServer.doCall(s.registration.send_serial, systemId, num,
                             cfg["oemId"])
        else:
            rpcServer.doCall(s.registration.send_serial, systemId, num)
    except xmlrpclib.Fault, f:
        if f.faultCode == 99:
            raise rhnErrors.DelayError(f.faultString)
        else:
            raise rhnErrors.CommunicationError(f.faultString)
Beispiel #10
0
def finishMessage(systemId):

    #    ret =  (-1, "blippyFoobar", "this is some text\n\n\nmore\n\ntext\\n\nfoo")
    #    return ret

    s = rpcServer.getServer()
    try:
        ret = rpcServer.doCall(s.registration.finish_message, systemId)
        return ret
    except xmlrpclib.Fault, f:
        if f.faultCode == 99:
            raise rhnErrors.DelayError(f.faultString)
        else:
            raise rhnErrors.CommunicationError(f.faultString)
Beispiel #11
0
def registerUser(username, password, email=None, orgid=None, orgpassword=None):
    s = rpcServer.getServer()

    try:
        if not email == None:
            if orgid and orgpassword:
                rpcServer.doCall(s.registration.new_user, username, password,
                                 email, orgid, orgpassword)
            else:
                rpcServer.doCall(s.registration.new_user, username, password,
                                 email)
        else:
            rpcServer.doCall(s.registration.new_user, username, password)
    except xmlrpclib.Fault, f:
        if f.faultCode == 99:
            raise rhnErrors.DelayError(f.faultString)
        else:
            raise rhnErrors.CommunicationError(f.faultString)
Beispiel #12
0
def registerSystem(username=None,
                   password=None,
                   profileName=None,
                   packages=None,
                   token=None,
                   other=None):
    s = rpcServer.getServer()

    auth_dict = {
        "profile_name": profileName,
        "os_release": rhnUtils.getVersion(),
        "release_name": rhnUtils.getOSRelease(),
        "architecture": rhnUtils.getArch()
    }

    # dict of other bits to send up
    if other:
        for (key, item) in other.items():
            auth_dict[key] = item

    if token:
        auth_dict["token"] = token
    else:
        auth_dict["username"] = username
        auth_dict["password"] = password

    auth_dict["uuid"] = cfg["uuid"] or ""
    auth_dict["rhnuuid"] = cfg["rhnuuid"] or ""

    try:
        if packages == None:
            ret = rpcServer.doCall(s.registration.new_system, auth_dict)
        else:
            ret = rpcServer.doCall(s.registration.new_system, auth_dict,
                                   packages)
    except xmlrpclib.Fault, f:
        if abs(f.faultCode) == 99:
            raise rhnErrors.DelayError(f.faultString)
        elif abs(f.faultCode) == 60:
            raise rhnErrors.AuthenticationTicketError(f.faultString)
        elif abs(f.faultCode) == 105:
            raise rhnErrors.RhnUuidUniquenessError(f.faultString)
        else:
            raise rhnErrors.CommunicationError(f.faultString)
Beispiel #13
0
def reserveUser(username, password):
    s = rpcServer.getServer()

    try:
        ret = rpcServer.doCall(s.registration.reserve_user, username, password)
    except xmlrpclib.Fault, f:
        if f.faultCode == -3:
            # account already in use
            raise rhnErrors.ValidationError(f.faultString)
        elif f.faultCode == -14:
            # too short password
            raise rhnErrors.ValidationError(f.faultString)
        elif f.faultCode == -15:
            # bad chars in username
            raise rhnErrors.ValidationError(f.faultString)
        elif f.faultCode == 99:
            raise rhnErrors.DelayError(f.faultString)
        else:
            raise rhnErrors.CommunicationError(f.faultString)