Esempio n. 1
0
    def run(self, parts=Inventory.INV_FULL):
        tmpdir = tempfile.mkdtemp()
        cmd = [ self.path, '--stdout', '--basevardir=%s' % tmpdir ]

        # Remove unwanted inventory parts
        if parts & Inventory.INV_SOFTWARE==0:
            cmd.append('--nosoftware')
        try:
            output = utils.runAgent(cmd)
            inv = Inventory.parse(output)
        finally:
            shutil.rmtree(tmpdir)
        return inv
Esempio n. 2
0
    def run(self, parts=Inventory.INV_FULL):
        tmpdir = tempfile.mkdtemp()
        # Disable options not related to inventory
        cmd = [ self.path, '--stdout', '--basevardir=%s' % tmpdir,
                '--no-deploy', '--no-ocsdeploy', '--no-socket', '--no-ssl-check',
                '--no-wakeonlan', '--no-snmpquery', '--no-netdiscovery',
                '--no-p2p']

        # Remove unwanted inventory parts
        # TODO: base hardware inventory is always done
        if parts & Inventory.INV_VM==0:
            cmd.append('--no-esx')
        if parts & Inventory.INV_PRINTER==0:
            cmd.append('--no-printer')
        if parts & Inventory.INV_SOFTWARE==0:
            cmd.append('--no-software')
        try:
            output = utils.runAgent(cmd)
            inv = Inventory.parse(output)
        finally:
            shutil.rmtree(tmpdir)
        return inv