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
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')
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')