Example #1
0
    def getxml(self):

        # see if there were any template strings loaded from the db,
        # {label:value}
        templateOverrides = rhnFlags.get('templateOverrides')

        # update the templateValues in the module
        if templateOverrides:
            for label in templateOverrides.keys():
                # only care about values we've defined defaults for...
                if templateValues.has_key(label):
                    templateValues[label] = templateOverrides[label]

        s = StringIO()
        s.write("\n")
        if self.text:
            s.write(_("Error Message:\n    %s\n") % self.text.strip())
        if self.code:
            s.write(_("Error Class Code: %s\n") % self.code)
        if self.arrayText:
            cinfo = self.arrayText % templateValues
            s.write(_("Error Class Info: %s\n") % cinfo.rstrip())
        if self.explain:
            s.write(_("Explanation: %s") % Explain)
        if not self.code:
            return xmlrpclib.Fault(1, s.getvalue())
        return xmlrpclib.Fault(-self.code, s.getvalue())
Example #2
0
    def getxml(self):

        # see if there were any template strings loaded from the db,
        # {label:value}
        templateOverrides = rhnFlags.get('templateOverrides')

        # update the templateValues in the module
        if templateOverrides:
            for label in templateOverrides.keys():
                # only care about values we've defined defaults for...
                if templateValues.has_key(label):
                    templateValues[label] = templateOverrides[label]

        s = StringIO()
        s.write("\n")
        if self.text:
            s.write(_("Error Message:\n    %s\n") % self.text.strip())
        if self.code:
            s.write(_("Error Class Code: %s\n") % self.code)
        if self.arrayText:
            cinfo = self.arrayText % templateValues
            s.write(_("Error Class Info: %s\n") % cinfo.rstrip())
        if self.explain:
            s.write(_("Explanation: %s") % Explain)
        if not self.code:
            return xmlrpclib.Fault(1, s.getvalue())
        return xmlrpclib.Fault(-self.code, s.getvalue())
Example #3
0
def exitWithTraceback(e, msg, exitnum, mail=0):
    tbOut = StringIO()
    Traceback(mail, ostream=tbOut, with_locals=1)
    log_error(-1, _('ERROR: %s %s: %s') %
              (e.__class__.__name__, msg, e))
    log_error(-1, _('TRACEBACK: %s') % tbOut.getvalue())
    sys.exit(exitnum)
Example #4
0
# default template values for error messages
templateValues = {
    'hostname': 'rhn.redhat.com',
    }


# This array translates exception codes into meaningful messages
# for the eye of the beholder
# DOMAINS:
#   0-999:     Red Hat client/client-like interaction errors
#   1000-1999: Proxy specific interaction errors
#   2000-2999: Red Hat Satellite specific interation errors

FaultArray = {
     # 0-999: Red Hat client/client-like interaction errors:
     1: _("This does not appear to be a valid username."),
     2: _("Invalid username and password combination."),
     3: _("This login is already taken, or the password is incorrect."),
     4: _("Permission denied."),
     6: _("Object not found."),
     8: _("Invalid System Digital ID."),
     9: _("Invalid System Credentials."),
     10: _("Could not retrieve user data from database."),
     11: _("Valid username required."),
     12: _("Valid password required."),
     13: _("Minimum username length violation."),
     14: _("Minimum password length violation."),
     15: _("The username contains invalid characters."),
     17: _("File not found."),
     19: _("Architecture and OS version combination is not supported."),
     20: _("Could not retrieve system data from database."),
Example #5
0
# default template values for error messages
templateValues = {
    'hostname': 'rhn.redhat.com',
}

# This array translates exception codes into meaningful messages
# for the eye of the beholder
# DOMAINS:
#   0-999:     Red Hat client/client-like interaction errors
#   1000-1999: Proxy specific interaction errors
#   2000-2999: Red Hat Satellite specific interation errors

FaultArray = {
    # 0-999: Red Hat client/client-like interaction errors:
    1:
    _("This does not appear to be a valid username."),
    2:
    _("Invalid username and password combination."),
    3:
    _("This login is already taken, or the password is incorrect."),
    4:
    _("Permission denied."),
    6:
    _("Object not found."),
    8:
    _("Invalid System Digital ID."),
    9:
    _("Invalid System Credentials."),
    10:
    _("Could not retrieve user data from database."),
    11:
Example #6
0
def exitWithTraceback(e, msg, exitnum, mail=0):
    tbOut = StringIO()
    Traceback(mail, ostream=tbOut, with_locals=1)
    log_error(-1, _('ERROR: %s %s: %s') % (e.__class__.__name__, msg, e))
    log_error(-1, _('TRACEBACK: %s') % tbOut.getvalue())
    sys.exit(exitnum)
Example #7
0
# default template values for error messages
templateValues = {
    'hostname': 'rhn.redhat.com',
    }


# This array translates exception codes into meaningful messages
# for the eye of the beholder
# DOMAINS:
#   0-999:     RHN client/client-like interaction errors
#   1000-1999: RHN Proxy specific interaction errors
#   2000-2999: RHN Satellite specific interation errors

FaultArray = {
     10000: _("Outage mode"),
     # 0-999: RHN client/client-like interaction errors:
     1: _("This does not appear to be a valid username."),
     2: _("Invalid username and password combination."),
     3: _("This login is already taken, or the password is incorrect."),
     4: _("Permission denied."),
     5: _("Can not create new entry."),
     6: _("Object not found."),
     7: _("Account limits exceeded."),
     8: _("Invalid System Digital ID."),
     9: _("Invalid System Credentials."),
     10: _("Could not retrieve user data from database."),
     11: _("Valid username required."),
     12: _("Valid password required."),
     13: _("Minimum username length violation."),
     14: _("Minimum password length violation."),