Esempio n. 1
0
    def cups_printer_show(self, object):
        if object.incomplete:
            self.finished(object.id(), [])
            return

        cmd = '/usr/bin/lpstat -o %s' % object.options['printer']
        ud.debug(ud.ADMIN, ud.INFO, 'CUPS.show: command: %s' % cmd)
        processresult = umct.run_process(cmd,
                                         timeout=10000,
                                         shell=True,
                                         output=True)
        lpstat_o_stdout = processresult['stdout'].readlines()
        ud.debug(ud.ADMIN, ud.INFO,
                 'CUPS.show: lpstat_o_stdout: %s' % lpstat_o_stdout)
        lpstat_o_stdout = tools.parse_lpstat_o(lpstat_o_stdout)

        cmd = '/usr/bin/lpstat -l -p %s' % object.options['printer']
        ud.debug(ud.ADMIN, ud.INFO, 'CUPS.show: command: %s' % cmd)
        processresult = umct.run_process(cmd,
                                         timeout=10000,
                                         shell=True,
                                         output=True)
        buffer = processresult['stdout'].readlines()
        ud.debug(ud.ADMIN, ud.INFO, 'CUPS.show: lpstat: %s' % buffer)
        self.finished(object.id(),
                      (lpstat_o_stdout, tools.parse_lpstat_l(buffer)))
        return
Esempio n. 2
0
    def cups_printer_show(self, object):
        if object.incomplete:
            self.finished(object.id(), [])
            return

        cmd = "/usr/bin/lpstat -o %s" % object.options["printer"]
        ud.debug(ud.ADMIN, ud.INFO, "CUPS.show: command: %s" % cmd)
        processresult = umct.run_process(cmd, timeout=10000, shell=True, output=True)
        lpstat_o_stdout = processresult["stdout"].readlines()
        ud.debug(ud.ADMIN, ud.INFO, "CUPS.show: lpstat_o_stdout: %s" % lpstat_o_stdout)
        lpstat_o_stdout = tools.parse_lpstat_o(lpstat_o_stdout)

        cmd = "/usr/bin/lpstat -l -p %s" % object.options["printer"]
        ud.debug(ud.ADMIN, ud.INFO, "CUPS.show: command: %s" % cmd)
        processresult = umct.run_process(cmd, timeout=10000, shell=True, output=True)
        buffer = processresult["stdout"].readlines()
        ud.debug(ud.ADMIN, ud.INFO, "CUPS.show: lpstat: %s" % buffer)
        self.finished(object.id(), (lpstat_o_stdout, tools.parse_lpstat_l(buffer)))
        return
Esempio n. 3
0
	def _cups_printer_show_return( self, pid, status, buffer, object ):
		jobs = tools.parse_lpstat_o( buffer )
		self.finished( object.id(), jobs )