def test_initialization(self):
        """Test whether attributes are initializated"""

        config = Config(CONF_FILE)
        task = TaskPanelsMenu(config)

        self.assertEqual(task.config, config)

        self.assertEqual(len(task.panels_menu), 33)

        for entry in task.panels_menu:
            self.assertGreaterEqual(len(entry['index-patterns']), 0)
def get_panels(config):
    """Execute the panels phase

    :param config: a Mordred config object
    """

    task = TaskPanels(config)
    task.execute()

    task = TaskPanelsMenu(config)
    task.execute()

    logging.info("Panels creation finished!")
Esempio n. 3
0
def main():
    """This script allows to upload the dashboards in use in the setup.cfg and the top menu. It
    relies on the TaskPanels and TaskPanelsMenu classes.

    Examples:
        Upload dashboards and menu: panels_config --cfg ./setup.cfg --dashboards --menu
        Upload only the dashboards: panels_config --cfg ./setup.cfg --dashboards
        Upload only the top menu:   panels_config --cfg ./setup.cfg --menu
    """
    args = get_params()
    config = Config(args.cfg_path)

    upload_dashboards = args.dashboards
    upload_menu = args.menu

    if upload_dashboards:
        task = TaskPanels(config)
        task.execute()

    if upload_menu:
        task = TaskPanelsMenu(config)
        task.execute()