Logo Search packages:      
Sourcecode: bcfg2 version File versions  Download package

def lib::Server::Plugins::Hostbase::buildHostsLPD (   self  ) 

Creates the /mcs/etc/hosts.lpd file

Definition at line 449 of file Hostbase.py.

00449                            :
        """Creates the /mcs/etc/hosts.lpd file"""
        
        # this header needs to be changed to be more generic
        header = """+@machines
+@all-machines
achilles.ctd.anl.gov
raven.ops.anl.gov
seagull.hr.anl.gov
parrot.ops.anl.gov
condor.ops.anl.gov
delphi.esh.anl.gov
anlcv1.ctd.anl.gov
anlvms.ctd.anl.gov
olivia.ctd.anl.gov\n\n"""
        
        cursor = connection.cursor()
        cursor.execute("""
        SELECT hostname FROM hostbase_host WHERE netgroup=\"red\" AND status = 'active'
        ORDER BY hostname""")
        redmachines = list(cursor.fetchall())
        cursor.execute("""
        SELECT n.name FROM ((hostbase_host h INNER JOIN hostbase_interface i ON h.id = i.host_id)
        INNER JOIN hostbase_ip p ON i.id = p.interface_id) INNER JOIN hostbase_name n ON p.id = n.ip_id
        WHERE netgroup=\"red\" AND n.only=1 AND h.status = 'active'
        """)
        redmachines.extend(list(cursor.fetchall()))
        cursor.execute("""
        SELECT hostname FROM hostbase_host WHERE netgroup=\"win\" AND status = 'active'
        ORDER BY hostname""")
        winmachines = list(cursor.fetchall())
        cursor.execute("""
        SELECT n.name FROM ((hostbase_host h INNER JOIN hostbase_interface i ON h.id = i.host_id)
        INNER JOIN hostbase_ip p ON i.id = p.interface_id) INNER JOIN hostbase_name n ON p.id = n.ip_id
        WHERE netgroup=\"win\" AND n.only=1 AND h.status = 'active'
        """)
        winmachines.__add__(list(cursor.fetchall()))
        hostslpdfile = header
        for machine in redmachines:
            hostslpdfile += machine[0] + "\n"
        hostslpdfile += "\n"
        for machine in winmachines:
            hostslpdfile += machine[0] + "\n"
        self.filedata['hosts.lpd'] = hostslpdfile
        self.Entries['ConfigFile']['/mcs/etc/hosts.lpd'] = self.FetchFile


    def buildNetgroups(self):


Generated by  Doxygen 1.6.0   Back to index