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

10. findLoginServers(): Display login server rows

This function scans the clientSet for systems that are considered login servers, and formats the rows of the server table.

hwscan3.py
# - - -   f i n d L o g i n S e r v e r s

def findLoginServers ( tbody, reportInfo, clientSet ):
    '''Build the rows of the login server table.

      [ (tbody is an et.Element) and
        (reportInfo is a ReportInfo instance) and
        (clientSet is a ClientSet instance) ->
          tbody  +:=  tr elements containing one row for each
              login server named in reportInfo, with configuration
              data from clientSet ]
    '''

The servers are presented in alphabetical order. We'll drive the process by extracting the keys from reportInfo.systemMap and sorting them, and then checking each of the System instances to see if its .isServer attribute is set.

hwscan3.py
    #-- 1 --
    # [ nameList  :=  a list of the keys of reportInfo.systemMap,
    #       sorted in ascending order ]
    nameList  =  reportInfo.systemMap.keys()
    nameList.sort()

    #-- 2 --
    # [ tbody  +:=  tr elements containing one row for each
    #       login server found in reportInfo.systemMap, in
    #       order by the names from nameList, with configuration
    #       data from clientSet ]
    for systemName in nameList:
        #-- 2 body --
        # [ if (reportInfo.systemMap[systemName].isServer) and
        #   (systemName is known to clientSet) ->
        #     tbody  +:=  a tr element for
        #         reportInfo.systemMap[systemName] with
        #         configuration data from clientSet
        #   else -> I ]
        system  =  reportInfo.systemMap[systemName]
        if system.isServer:
            #-- 2.1 --
            # [ if system.nodename is known to clientSet ->
            #     tbody  +:=  a tr element for system with
            #         configuration data from clientSet
            #   else ->
            #     sys.stderr  +:=  message about unknown server ]
            buildServerRow ( tbody, system, clientSet )