Ejemplo n.º 1
0
 def system_id(self):
     log_debug(3, self.server, self.cert)
     if self.cert is None:
         # need to instantiate it
         cert = Certificate()
         cert["system_id"] = self.server["digital_server_id"]
         cert["os_release"] = self.server["release"]
         cert["operating_system"] = self.server["os"]
         cert["architecture"] = self.archname
         cert["profile_name"] = self.server["name"]
         cert["description"] = self.server["description"]
         if self.user:
             cert["username"] = self.user.contact["login"]
         cert["type"] = self.type
         cert.set_secret(self.server["secret"])
         self.cert = cert
     return self.cert.certificate()
Ejemplo n.º 2
0
 def system_id(self):
     log_debug(3, self.server, self.cert)
     if self.cert is None:
         # need to instantiate it
         cert = Certificate()
         cert["system_id"] = self.server["digital_server_id"]
         cert["os_release"] = self.server["release"]
         cert["operating_system"] = self.server["os"]
         cert["architecture"] = self.archname
         cert["profile_name"] = self.server["name"]
         cert["description"] = self.server["description"]
         if self.user:
             cert["username"] = self.user.contact["login"]
         cert["type"] = self.type
         cert.set_secret(self.server["secret"])
         self.cert = cert
     return self.cert.certificate()
Ejemplo n.º 3
0
def get(system_id, load_user = 1):
    log_debug(3, "load_user = %s" % load_user)
    # This has to be a string
    if not type(system_id) == type(""):
        return None
    # Try to initialize the certificate object
    cert = Certificate()
    if not cert.reload(system_id) == 0:
        return None
    # if invalid, stop here
    if not cert.valid():
        return None    

    # this looks like a real server
    server = Server(None)
    # and load it up
    if not server.loadcert(cert, load_user) == 0:
        return None   
    # okay, it is a valid certificate
    return server
Ejemplo n.º 4
0
def get(system_id, load_user=1):
    """ retrieve the server with matching certificate from the database """
    log_debug(3, "load_user = %s" % load_user)
    # This has to be a string
    if not isinstance(system_id, (StringType, UnicodeType)):
        return None
    # Try to initialize the certificate object
    cert = Certificate()
    if not cert.reload(system_id) == 0:
        return None
    # if invalid, stop here
    if not cert.valid():
        return None

    # this looks like a real server
    server = Server(None)
    # and load it up
    if not server.loadcert(cert, load_user) == 0:
        return None
    # okay, it is a valid certificate
    return server
Ejemplo n.º 5
0
 def system_id(self):
     log_debug(3, self.server, self.cert)
     if self.cert is None:
         # need to instantiate it
         cert = Certificate()
         cert["system_id"] = self.server["digital_server_id"]
         cert["os_release"] = self.server["release"]
         cert["operating_system"] = self.server["os"]
         cert["architecture"] = self.archname
         cert["profile_name"] = self.server["name"]
         cert["description"] = self.server["description"]
         if not self.user:
             log_debug(1, "The username is not available. Taking an active " \
                          "administrator from the same organization")
             self.user = rhnUser.search(self._get_active_org_admins(
                 self.server["org_id"])[0]["login"])
         cert["username"] = self.user.contact["login"]
         cert["type"] = self.type
         cert.set_secret(self.server["secret"])
         self.cert = cert
     return self.cert.certificate()
Ejemplo n.º 6
0
 def system_id(self):
     log_debug(3, self.server, self.cert)
     if self.cert is None:
         # need to instantiate it
         cert = Certificate()
         cert["system_id"] = self.server["digital_server_id"]
         cert["os_release"] = self.server["release"]
         cert["operating_system"] = self.server["os"]
         cert["architecture"] = self.archname
         cert["profile_name"] = self.server["name"]
         cert["description"] = self.server["description"]
         if not self.user:
             log_debug(1, "The username is not available. Taking an active " \
                          "administrator from the same organization")
             self.user = rhnUser.search(
                 self._get_active_org_admins(
                     self.server["org_id"])[0]["login"])
         cert["username"] = self.user.contact["login"]
         cert["type"] = self.type
         cert.set_secret(self.server["secret"])
         self.cert = cert
     return self.cert.certificate()