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

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

The /mcs/etc/printers.data file

Definition at line 416 of file Hostbase.py.

00416                            :
        """The /mcs/etc/printers.data file"""
        header = """#  This file is automatically generated. DO NOT EDIT IT!
#
Name            Room        User                            Type                      Notes
==============  ==========  ==============================  ========================  ====================
"""

        cursor = connection.cursor()
        # fetches all the printers from the database
        cursor.execute("""
        SELECT printq, location, primary_user, comments
        FROM hostbase_host
        WHERE whatami='printer' AND printq <> '' AND status = 'active'
        ORDER BY printq
        """)
        printers = cursor.fetchall()

        printersfile = header
        for printer in printers:
            # splits up the printq line and gets the
            # correct description out of the comments section
            temp = printer[3].split('\n')
            for printq in re.split(',[ ]*', printer[0]):
                if len(temp) > 1:
                    printersfile += ("%-16s%-12s%-32s%-26s%s\n" %
                                     (printq, printer[1], printer[2], temp[1], temp[0]))
                else:
                    printersfile += ("%-16s%-12s%-32s%-26s%s\n" %
                                     (printq, printer[1], printer[2], '', printer[3]))
        self.filedata['printers.data'] = printersfile
        self.Entries['ConfigFile']['/mcs/etc/printers.data'] = self.FetchFile

    def buildHostsLPD(self):


Generated by  Doxygen 1.6.0   Back to index