How to use the molecule.config.Config function in molecule

To help you get started, we’ve selected a few molecule examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ansible / molecule / test / unit / verifier / lint / test_yamllint.py View on Github external
def test_config_private_member(_instance):
    assert isinstance(_instance._config, config.Config)
github ansible / molecule / test / unit / driver / test_openstack.py View on Github external
def test_config_private_member(_instance):
    assert isinstance(_instance._config, config.Config)
github ansible / molecule / tests / unit / test_core.py View on Github external
def molecule_instance(temp_files, molecule_args):
    c = temp_files(fixtures=['molecule_vagrant_config'])
    m = core.Molecule(molecule_args)
    m.config = config.Config(configs=c)
    m.main()

    return m
github ansible / molecule / test / unit / driver / test_linode.py View on Github external
def test_linode_config_gives_config_object(linode_instance):
    assert isinstance(linode_instance._config, config.Config)
github ansible / molecule / test / unit / test_scenarios.py View on Github external
def test_configs_private_member(_instance):
    assert 2 == len(_instance._configs)
    assert isinstance(_instance._configs[0], config.Config)
    assert isinstance(_instance._configs[1], config.Config)
github ansible / molecule / test / unit / provisioner / test_ansible.py View on Github external
def test_config_private_member(ansible_instance):
    assert isinstance(ansible_instance._config, config.Config)
github ansible / molecule / test / unit / verifier / test_goss.py View on Github external
def test_config_private_member(_instance):
    assert isinstance(_instance._config, config.Config)
github ansible / molecule / test / unit / test_state.py View on Github external
def test_get_data_loads_existing_state_file(temp_dir, molecule_data):
    molecule_directory = config.molecule_directory(temp_dir.strpath)
    scenario_directory = os.path.join(molecule_directory, 'default')
    molecule_file = config.molecule_file(scenario_directory)
    ephemeral_directory = config.molecule_ephemeral_directory(
        scenario_directory)
    state_file = os.path.join(ephemeral_directory, 'state.yml')

    os.makedirs(ephemeral_directory)

    data = {'converged': False, 'created': True, 'driver': None}
    util.write_file(state_file, util.safe_dump(data))

    pytest.helpers.write_molecule_file(molecule_file, molecule_data)
    c = config.Config(molecule_file)
    s = state.State(c)

    assert not s.converged
    assert s.created
    assert not s.driver
github ansible / molecule / molecule / provisioner / ansible / plugins / modules / molecule_vagrant.py View on Github external
def _get_config(self):
        molecule_file = os.environ['MOLECULE_FILE']

        return molecule.config.Config(molecule_file)
github ansible / molecule / molecule / command / base.py View on Github external
def get_configs(args, command_args, ansible_args=()):
    """
    Glob the current directory for Molecule config files, instantiate config
    objects, and returns a list.

    :param args: A dict of options, arguments and commands from the CLI.
    :param command_args: A dict of options passed to the subcommand from
     the CLI.
    :param ansible_args: An optional tuple of arguments provided to the
     `ansible-playbook` command.
    :return: list
    """
    configs = [
        config.Config(
            molecule_file=util.abs_path(c),
            args=args,
            command_args=command_args,
            ansible_args=ansible_args,
        )
        for c in glob.glob(MOLECULE_GLOB)
    ]
    _verify_configs(configs)

    return configs