How to use the molecule.util.safe_load_file 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 / cookiecutter / test_molecule.py View on Github external
def test_valid(temp_dir, _molecule_file, _role_directory, _command_args, _instance):
    _instance._process_templates('molecule', _command_args, _role_directory)

    data = util.safe_load_file(_molecule_file)

    assert {} == schema_v2.validate(data)

    cmd = sh.yamllint.bake('-s', _molecule_file)
    pytest.helpers.run_command(cmd)
github ansible / molecule / test / unit / cookiecutter / test_molecule.py View on Github external
def test_verifier_lint_when_verifier_inspec(
    temp_dir, _molecule_file, _role_directory, _command_args, _instance
):
    _command_args['verifier_name'] = 'inspec'
    _command_args['verifier_lint_name'] = 'rubocop'
    _instance._process_templates('molecule', _command_args, _role_directory)

    data = util.safe_load_file(_molecule_file)

    assert {} == schema_v2.validate(data)

    cmd = sh.yamllint.bake('-s', _molecule_file)
    pytest.helpers.run_command(cmd)
github ansible / molecule / molecule / driver / gce.py View on Github external
def _get_instance_config(self, instance_name):
        instance_config_dict = util.safe_load_file(self._config.driver.instance_config)

        return next(
            item for item in instance_config_dict if item['instance'] == instance_name
        )
github ansible / molecule / molecule / driver / azure.py View on Github external
def _get_instance_config(self, instance_name):
        instance_config_dict = util.safe_load_file(self._config.driver.instance_config)

        return next(
            item for item in instance_config_dict if item['instance'] == instance_name
        )
github ansible / molecule / molecule / driver / openstack.py View on Github external
def _get_instance_config(self, instance_name):
        instance_config_dict = util.safe_load_file(self._config.driver.instance_config)

        return next(
            item for item in instance_config_dict if item['instance'] == instance_name
        )
github ansible / molecule / molecule / driver / ec2.py View on Github external
def _get_instance_config(self, instance_name):
        instance_config_dict = util.safe_load_file(self._config.driver.instance_config)

        return next(
            item for item in instance_config_dict if item["instance"] == instance_name
        )
github ansible / molecule / molecule / state.py View on Github external
def _load_file(self):
        return util.safe_load_file(self.state_file)