예제 #1
0
def activate():
    logger = logging.getLogger()
    config = InventoryConfig()
    config.init("inventory")
    logger.debug("Inventory %s" % str(config.disable))
    if config.disable:
        logger.warning("Plugin inventory: disabled by configuration.")
        return False

    # When this module is used by the MMC agent, the global inventory variable is shared.
    # This means an Inventory instance is not created each time a XML-RPC call is done.
    if not InventoryLocation().init(
            config
    ):  # does Inventory().activate() (which does the Inventory().db_check())
        return False

    logger.info("Plugin inventory: Inventory database version is %d" %
                Inventory().dbversion)

    ComputerManager().register("inventory", InventoryComputers)
    ProvisioningManager().register('inventory', InventoryProvisioner)
    ComputerLocationManager().register('inventory', InventoryLocation)

    PossibleQueries().init(config)

    # Register the panel to the DashboardManager
    try:
        from mmc.plugins.dashboard.manager import DashboardManager
        from mmc.plugins.inventory.panel import InventoryPanel
        DM = DashboardManager()
        DM.register_panel(InventoryPanel("inventory"))
    except ImportError:
        pass

    return True
예제 #2
0
파일: __init__.py 프로젝트: AnatomicJC/mmc
def activate():
    logger = logging.getLogger()
    config = InventoryConfig()
    config.init("inventory")
    logger.debug("Inventory %s"%str(config.disable))
    if config.disable:
        logger.warning("Plugin inventory: disabled by configuration.")
        return False

    # When this module is used by the MMC agent, the global inventory variable is shared.
    # This means an Inventory instance is not created each time a XML-RPC call is done.
    if not InventoryLocation().init(config): # does Inventory().activate() (which does the Inventory().db_check())
        return False

    logger.info("Plugin inventory: Inventory database version is %d" % Inventory().dbversion)

    ComputerManager().register("inventory", InventoryComputers)
    ProvisioningManager().register('inventory', InventoryProvisioner)
    ComputerLocationManager().register('inventory', InventoryLocation)

    PossibleQueries().init(config)

    # Register the panel to the DashboardManager
    try:
        from mmc.plugins.dashboard.manager import DashboardManager
        from mmc.plugins.inventory.panel import InventoryPanel
        DM = DashboardManager()
        DM.register_panel(InventoryPanel("inventory"))
    except ImportError:
        pass

    return True
예제 #3
0
파일: __init__.py 프로젝트: tekmans/mmc
def activate():
    logger = logging.getLogger()
    config = InventoryConfig()
    config.init("inventory")
    logger.debug("Inventory %s"%str(config.disable))
    if config.disable:
        logger.warning("Plugin inventory: disabled by configuration.")
        return False

    # When this module is used by the MMC agent, the global inventory variable is shared.
    # This means an Inventory instance is not created each time a XML-RPC call is done.
    if not InventoryLocation().init(config): # does Inventory().activate() (which does the Inventory().db_check())
        return False

    logger.info("Plugin inventory: Inventory database version is %d" % Inventory().dbversion)

    ComputerManager().register("inventory", InventoryComputers)
    ProvisioningManager().register('inventory', InventoryProvisioner)
    ComputerLocationManager().register('inventory', InventoryLocation)

    PossibleQueries().init(config)
    return True
예제 #4
0
 def getInventoryGraph(self, col):
     conf = InventoryConfig()
     return conf.graph[col]
예제 #5
0
 def getInventoryEM(self, col):
     conf = InventoryConfig()
     return conf.expert_mode[col]
예제 #6
0
 def __init__(self, conffile = None):
     self.logger = logging.getLogger()
     self.config = InventoryConfig()
     self.inventory = Inventory()