コード例 #1
0
ファイル: main.py プロジェクト: mpryc/InfraRed
def main(args=None):
    # configure core services
    CoreServices.setup('infrared.cfg')

    # Init Managers
    plugin_manager = CoreServices.plugins_manager()

    specs_manager = api.SpecManager()

    specs_manager.register_spec(
        WorkspaceManagerSpec('workspace',
                             description="Workspace manager. "
                                         "Allows to create and use an "
                                         "isolated environment for plugins "
                                         "execution."))
    specs_manager.register_spec(
        PluginManagerSpec('plugin',
                          plugin_manager=plugin_manager,
                          description="Plugin management"))

    specs_manager.register_spec(
        SSHSpec(
            'ssh',
            description="Interactive ssh session to node from inventory."))

    # register all plugins
    for plugin in plugin_manager.PLUGINS_DICT.values():
        specs_manager.register_spec(api.InfraredPluginsSpec(plugin))

    return specs_manager.run_specs(args) or 0
コード例 #2
0
ファイル: main.py プロジェクト: vkmc/infrared
def main(args=None):
    CoreServices.setup()

    # inject ansible config file
    CoreServices.ansible_config_manager().inject_config()

    specs_manager = api.SpecManager()

    # Init Managers
    specs_manager.register_spec(
        WorkspaceManagerSpec('workspace',
                             description="Workspace manager. "
                             "Allows to create and use an "
                             "isolated environment for plugins "
                             "execution."))
    specs_manager.register_spec(
        PluginManagerSpec('plugin', description="Plugin management"))

    specs_manager.register_spec(
        SSHSpec('ssh',
                description="Interactive ssh session to node from inventory."))

    # register all plugins
    for plugin in CoreServices.plugins_manager().PLUGINS_DICT.values():
        specs_manager.register_spec(api.InfraredPluginsSpec(plugin))

    argcomplete.autocomplete(specs_manager.parser)
    return specs_manager.run_specs(args) or 0
コード例 #3
0
ファイル: main.py プロジェクト: ruslanloman/infrared
def main(args=None):
    CoreServices.setup()

    # inject existing libraries.
    # because of that all the ansible modules should be imported after that
    CoreServices.dependency_manager().inject_libraries()

    specs_manager = api.SpecManager()

    # Init Managers
    specs_manager.register_spec(
        WorkspaceManagerSpec('workspace',
                             description="Workspace manager. "
                             "Allows to create and use an "
                             "isolated environment for plugins "
                             "execution."))
    specs_manager.register_spec(
        PluginManagerSpec('plugin', description="Plugin management"))

    specs_manager.register_spec(
        SSHSpec('ssh',
                description="Interactive ssh session to node from inventory."))

    # register all plugins
    for plugin in CoreServices.plugins_manager().PLUGINS_DICT.values():
        specs_manager.register_spec(api.InfraredPluginsSpec(plugin))

    argcomplete.autocomplete(specs_manager.parser)
    return specs_manager.run_specs(args) or 0
コード例 #4
0
ファイル: main.py プロジェクト: sileht/infrared
def main(args=None):
    # configure core services
    CoreServices.setup('infrared.cfg')

    # Init Managers
    plugin_manager = CoreServices.plugins_manager()

    specs_manager = api.SpecManager()

    specs_manager.register_spec(
        WorkspaceManagerSpec('workspace',
                             description="Workspace manager. "
                             "Allows to create and use an "
                             "isolated environment for plugins "
                             "execution."))
    specs_manager.register_spec(
        PluginManagerSpec('plugin',
                          plugin_manager=plugin_manager,
                          description="Plugin management"))

    specs_manager.register_spec(
        SSHSpec('ssh',
                description="Interactive ssh session to node from inventory."))

    # register all plugins
    for plugin in plugin_manager.PLUGINS_DICT.values():
        specs_manager.register_spec(api.InfraredPluginsSpec(plugin))

    return specs_manager.run_specs(args) or 0
コード例 #5
0
    def plugin_manager_helper(plugins_conf_dict=None):

        if plugins_conf_dict is None:
            plugins_conf_dict = {}

        plugins_conf_dict.update(SUPPORTED_TYPES_DICT)

        with lp_file.open(mode='w') as fp:
            config = ConfigParser.ConfigParser()
            for section, section_data in plugins_conf_dict.items():
                config.add_section(section)
                for option, value in section_data.items():
                    config.set(section, option, value)
            config.write(fp)

        # replace core service with or test service
        # dependency manager will live in the temp folder
        # so we can keep it unmocked.
        CoreServices.register_service(
            ServiceName.DEPENDENCY_MANAGER,
            PluginDependencyManager(os.path.join(lp_file.dirname, ".library")))
        CoreServices.register_service(
            ServiceName.PLUGINS_MANAGER,
            InfraredPluginManager(lp_file.strpath,
                                  CoreServices.dependency_manager(),
                                  os.path.join(lp_file.dirname, "plugins")))
        return CoreServices.plugins_manager()
コード例 #6
0
ファイル: main.py プロジェクト: ovorobio/InfraRed
def main(args=None):
    CoreServices.setup()

    # inject existing libraries.
    # because of that all the ansible modules should be imported after that
    CoreServices.dependency_manager().inject_libraries()

    specs_manager = api.SpecManager()

    # Init Managers
    specs_manager.register_spec(
        WorkspaceManagerSpec('workspace',
                             description="Workspace manager. "
                                         "Allows to create and use an "
                                         "isolated environment for plugins "
                                         "execution."))
    specs_manager.register_spec(
        PluginManagerSpec('plugin',
                          description="Plugin management"))

    specs_manager.register_spec(
        SSHSpec(
            'ssh',
            description="Interactive ssh session to node from inventory."))

    # register all plugins
    for plugin in CoreServices.plugins_manager().PLUGINS_DICT.values():
        specs_manager.register_spec(api.InfraredPluginsSpec(plugin))

    argcomplete.autocomplete(specs_manager.parser)
    return specs_manager.run_specs(args) or 0
コード例 #7
0
ファイル: test_plugins.py プロジェクト: ovorobio/InfraRed
    def plugin_manager_helper(plugins_conf_dict=None):

        if plugins_conf_dict is None:
            plugins_conf_dict = {}

        plugins_conf_dict.update(SUPPORTED_TYPES_DICT)

        with lp_file.open(mode='w') as fp:
            config = ConfigParser.ConfigParser()
            for section, section_data in plugins_conf_dict.items():
                config.add_section(section)
                for option, value in section_data.items():
                    config.set(section, option, value)
            config.write(fp)

        # replace core service with or test service
        # dependency manager will live in the temp folder
        # so we can keep it unmocked.
        CoreServices.register_service(
            ServiceName.DEPENDENCY_MANAGER, PluginDependencyManager(
                os.path.join(lp_file.dirname, ".library")))
        CoreServices.register_service(
            ServiceName.PLUGINS_MANAGER, InfraredPluginManager(
                lp_file.strpath, CoreServices.dependency_manager(),
                os.path.join(lp_file.dirname, "plugins")))
        return CoreServices.plugins_manager()
コード例 #8
0
def test_infrared_home_dir(infrared_home):
    test_settings = CoreSettings()
    test_settings.install_plugin_at_start = False
    CoreServices.setup(test_settings)

    assert os.path.isdir(infrared_home)
    assert os.path.isdir(os.path.join(infrared_home, '.workspaces'))
    assert os.path.isdir(os.path.join(infrared_home, '.library'))
    assert os.path.isfile(os.path.join(infrared_home, '.plugins.ini'))
    assert os.path.isdir(os.path.join(infrared_home, 'plugins'))
    assert CoreServices.workspace_manager().workspace_dir == os.path.join(
        infrared_home, '.workspaces')
    assert CoreServices.plugins_manager().config_file == os.path.join(
        infrared_home, '.plugins.ini')
    assert CoreServices.plugins_manager().plugins_dir == os.path.join(
        infrared_home, 'plugins')
コード例 #9
0
ファイル: bash_completers.py プロジェクト: zzzeek/infrared
def plugin_list(**kwargs):
    """Return plugins names list"""
    plugin_manager = CoreServices.plugins_manager()
    installed_plugins = plugin_manager.get_installed_plugins()
    completions = []
    for ptype, plugin in installed_plugins.iteritems():
        completions.extend(plugin.keys())
    return completions
コード例 #10
0
ファイル: bash_completers.py プロジェクト: obaranov/InfraRed
def plugin_list(**kwargs):
    """Return plugins names list"""
    plugin_manager = CoreServices.plugins_manager()
    installed_plugins = plugin_manager.get_installed_plugins()
    completions = []
    for ptype, plugin in installed_plugins.items():
        completions.extend(plugin.keys())
    return completions
コード例 #11
0
def test_infrared_home_dir(infrared_home):
    os.environ['ANSIBLE_CONFIG'] = os.path.join(infrared_home, 'ansible.cfg')
    test_settings = CoreSettings()
    test_settings.install_plugin_at_start = False
    CoreServices.setup(test_settings)

    assert os.path.isdir(infrared_home)
    assert os.path.isdir(os.path.join(infrared_home, '.workspaces'))
    assert os.path.isfile(os.path.join(infrared_home, '.plugins.ini'))
    assert os.path.isdir(os.path.join(infrared_home, 'plugins'))
    assert os.path.isfile(os.path.join(infrared_home, 'ansible.cfg'))
    assert CoreServices.workspace_manager().workspace_dir == os.path.join(
        infrared_home, '.workspaces')
    assert CoreServices.plugins_manager().config_file == os.path.join(
        infrared_home, '.plugins.ini')
    assert CoreServices.plugins_manager().plugins_dir == os.path.join(
        infrared_home, 'plugins')
    assert CoreServices.ansible_config_manager(
    ).ansible_config_path == os.path.join(infrared_home, 'ansible.cfg')
コード例 #12
0
ファイル: test_core_config.py プロジェクト: obaranov/InfraRed
def test_infrared_home_dir(infrared_home):
    os.environ['ANSIBLE_CONFIG'] = os.path.join(infrared_home, 'ansible.cfg')
    test_settings = CoreSettings()
    test_settings.install_plugin_at_start = False
    CoreServices.setup(test_settings)

    assert os.path.isdir(infrared_home)
    assert os.path.isdir(os.path.join(infrared_home, '.workspaces'))
    assert os.path.isfile(os.path.join(infrared_home, '.plugins.ini'))
    assert os.path.isdir(os.path.join(infrared_home, 'plugins'))
    assert os.path.isfile(os.path.join(infrared_home, 'ansible.cfg'))
    assert CoreServices.workspace_manager().workspace_dir == os.path.join(
        infrared_home, '.workspaces')
    assert CoreServices.plugins_manager().config_file == os.path.join(
        infrared_home, '.plugins.ini')
    assert CoreServices.plugins_manager().plugins_dir == os.path.join(
        infrared_home, 'plugins')
    assert CoreServices.ansible_config_manager().ansible_config_path == os.path.join(
        infrared_home, 'ansible.cfg')
コード例 #13
0
ファイル: test_plugins.py プロジェクト: dprince/infrared
    def plugin_manager_helper(plugins_conf_dict=None):

        if plugins_conf_dict is None:
            plugins_conf_dict = {}

        plugins_conf_dict.update(SUPPORTED_TYPES_DICT)

        with lp_file.open(mode='w') as fp:
            config = ConfigParser.ConfigParser()
            for section, section_data in plugins_conf_dict.items():
                config.add_section(section)
                for option, value in section_data.items():
                    config.set(section, option, value)
            config.write(fp)

        # replace core service with or test service
        CoreServices.register_service(ServiceName.PLUGINS_MANAGER,
                                      InfraredPluginManager(lp_file.strpath))
        return CoreServices.plugins_manager()
コード例 #14
0
ファイル: test_plugins.py プロジェクト: mpryc/InfraRed
    def plugin_manager_helper(plugins_conf_dict=None):

        if plugins_conf_dict is None:
            plugins_conf_dict = {}

        plugins_conf_dict.update(SUPPORTED_TYPES_DICT)

        with lp_file.open(mode='w') as fp:
            config = ConfigParser.ConfigParser()
            for section, section_data in plugins_conf_dict.items():
                config.add_section(section)
                for option, value in section_data.items():
                    config.set(section, option, value)
            config.write(fp)

        # replace core service with or test service
        CoreServices.register_service(ServiceName.PLUGINS_MANAGER,
                                      InfraredPluginManager(lp_file.strpath))
        return CoreServices.plugins_manager()
コード例 #15
0
ファイル: main.py プロジェクト: vkmc/infrared
 def __init__(self, name, *args, **kwargs):
     super(PluginManagerSpec, self).__init__(name, *args, **kwargs)
     self.plugin_manager = CoreServices.plugins_manager()
コード例 #16
0
ファイル: main.py プロジェクト: ovorobio/InfraRed
 def __init__(self, name, *args, **kwargs):
     super(PluginManagerSpec, self).__init__(name, *args, **kwargs)
     self.plugin_manager = CoreServices.plugins_manager()