Next / Previous / Contents / TCC Help System / NM Tech homepage

25.6. ClientSet.__buildClientMap(): Extract configuration data

This function handles all calls to the GetHardware XML-RPC service. For clients that are known to GetHardware, we build a ClientConfig instance containing the client's hardware configuration data, and add an entry to self.__clientMap whose key is the client's unqualified host name and whose value is that ClientConfig instance.

hwscan3.py
# - - -   C l i e n t S e t . _ _ b u i l d C l i e n t M a p

    def __buildClientMap ( self, reportInfo, ldapMap ):
        '''Transform LDAP client entries into ClientConfig instances.

          [ (reportInfo is a ReportInfo instance) and
            (ldapMap is a dictionary whose keys are unqualified
            client names, and each corresponding value is that
            client's tccSpecialOS value (defaulting to '')) ->
              self  :=  self with ClientConfig instances added for
                  clients whose hostnames are keys of ldapMap and
                  for which the GetHardware XML-RPC interface has
                  client configuration data ]
        '''

First we instantiate an XML-RPC server to handle all the queries to GetHardware. See Section 6.20, “FORGE_SERVER.

hwscan3.py
        #-- 1 --
        # [ rpcServer  :=  an XML-RPC server at FORGE_SERVER
        #   self.__clientMap  :=  a new, empty dictionary ]
        rpcServer  =  xmlrpclib.ServerProxy ( FORGE_SERVER )
        self.__clientMap  =  {}

For each entry in ldapMap, we query this server and, if a result is returned, add a corresponding entry to self.__clientMap.

hwscan3.py
        #-- 2 --
        # [ self.__clientMap  +:=  entries for clients from
        #       the host names from the keys of ldapMap that
        #       are known to rpcServer, where each entry's key
        #       is the host name and the corresponding value
        #       is a ClientConfig instance made from ldapMap[host name]
        #       and the result returned from rpcServer ]
        for hostName in ldapMap:
            #-- 2 body --
            # [ (hostName is a host name string) and
            #   (ldapMap[hostName] is a tccSpecialOS value) ->
            #     if rpcServer returns a value for hostName ->
            #       self.__clientMap[hostName]  :=  a ClientConfig
            #           instance made from ldapMap[hostName], os,
            #           and the value returned from rpcServer
            #     else -> I ]
            self.__findConfig ( reportInfo, rpcServer, hostName,
                                ldapMap[hostName] )