コード例 #1
0
ファイル: testinfra.py プロジェクト: DalavanCloud/molecule
    def execute(self):
        """
        Executes linting/integration tests and returns None.

        Flake8 performs the code linting.
        Testinfra executes integration tests.

        :return: None
        """
        ansible = ansible_playbook.AnsiblePlaybook(
            self._molecule.config.config['ansible'], {},
            _env=self._molecule.env)

        testinfra_options = config.merge_dicts(
            self._molecule.driver.testinfra_args,
            self._molecule.verifier_options)

        testinfra_options['ansible_env'] = ansible.env
        if self._molecule.args.get('debug'):
            testinfra_options['debug'] = True
        if self._molecule.args.get('sudo'):
            testinfra_options['sudo'] = True

        tests = self._get_tests()
        if len(tests) > 0:
            if 'flake8' not in self._molecule.disabled:
                self._flake8(tests)
            self._testinfra(tests, **testinfra_options)
コード例 #2
0
ファイル: test_config.py プロジェクト: kireledan/molecule
def test_merge_dicts():
    # example taken from python-anyconfig/anyconfig/__init__.py
    a = {'b': [{'c': 0}, {'c': 2}], 'd': {'e': 'aaa', 'f': 3}}
    b = {'a': 1, 'b': [{'c': 3}], 'd': {'e': 'bbb'}}
    x = {'a': 1, 'b': [{'c': 3}], 'd': {'e': "bbb", 'f': 3}}

    assert x == config.merge_dicts(a, b)
コード例 #3
0
ファイル: testinfra.py プロジェクト: davidfischer-ch/molecule
    def execute(self):
        """
        Executes linting/integration tests and returns None.

        Flake8 performs the code linting.
        Testinfra executes integration tests.

        :return: None
        """
        ansible = ansible_playbook.AnsiblePlaybook(
            self._molecule.config.config['ansible'], {},
            _env=self._molecule.env)

        testinfra_options = config.merge_dicts(
            self._molecule.driver.testinfra_args,
            self._molecule.config.config['verifier']['options'])

        testinfra_options['ansible_env'] = ansible.env
        if self._molecule.args.get('debug'):
            testinfra_options['debug'] = True
        if self._molecule.args.get('sudo'):
            testinfra_options['sudo'] = True

        tests = self._get_tests()
        if len(tests) > 0:
            if 'flake8' not in self._molecule.disabled:
                self._flake8(tests)
            self._testinfra(tests, **testinfra_options)
コード例 #4
0
def molecule_vagrant_v1_config_using_env(molecule_v1_section_data,
                                         vagrant_v1_section_data_using_env,
                                         ansible_v1_section_data):
    return reduce(lambda x, y: config.merge_dicts(x, y), [
        molecule_v1_section_data, vagrant_v1_section_data_using_env,
        ansible_v1_section_data
    ])
コード例 #5
0
ファイル: conftest.py プロジェクト: davidfischer-ch/molecule
def molecule_openstack_v1_config(molecule_v1_section_data,
                                 openstack_v1_section_data,
                                 ansible_v1_section_data):
    return reduce(lambda x, y: config.merge_dicts(x, y), [
        molecule_v1_section_data, openstack_v1_section_data,
        ansible_v1_section_data
    ])
コード例 #6
0
ファイル: conftest.py プロジェクト: vermuz/molecule
def molecule_docker_cluster_v1_config(molecule_v1_section_data,
                                      docker_cluster_v1_section_data,
                                      ansible_v1_section_data):
    return reduce(lambda x, y: config.merge_dicts(x, y), [
        molecule_v1_section_data, docker_cluster_v1_section_data,
        ansible_v1_section_data
    ])
コード例 #7
0
ファイル: conftest.py プロジェクト: davidfischer-ch/molecule
def molecule_vagrant_v1_config_using_env(molecule_v1_section_data,
                                         vagrant_v1_section_data_using_env,
                                         ansible_v1_section_data):
    return reduce(lambda x, y: config.merge_dicts(x, y), [
        molecule_v1_section_data, vagrant_v1_section_data_using_env,
        ansible_v1_section_data
    ])
コード例 #8
0
ファイル: test_config.py プロジェクト: neilus/molecule
def test_merge_dicts():
    # example taken from python-anyconfig/anyconfig/__init__.py
    a = {'b': [{'c': 0}, {'c': 2}], 'd': {'e': 'aaa', 'f': 3}}
    b = {'a': 1, 'b': [{'c': 3}], 'd': {'e': 'bbb'}}
    x = {'a': 1, 'b': [{'c': 3}], 'd': {'e': "bbb", 'f': 3}}

    assert x == config.merge_dicts(a, b)
コード例 #9
0
def molecule_openstack_v1_config(molecule_v1_section_data,
                                 openstack_v1_section_data,
                                 ansible_v1_section_data):
    return reduce(lambda x, y: config.merge_dicts(x, y), [
        molecule_v1_section_data, openstack_v1_section_data,
        ansible_v1_section_data
    ])
コード例 #10
0
ファイル: test_config.py プロジェクト: sebinjohn/molecule
def test_merge_dicts():
    # Example taken from python-anyconfig/anyconfig/__init__.py
    a = {'b': [{'c': 0}, {'c': 2}], 'd': {'e': 'aaa', 'f': 3}}
    b = {'a': 1, 'b': [{'c': 3}], 'd': {'e': 'bbb'}}
    expected = {'a': 1, 'b': [{'c': 3}], 'd': {'e': "bbb", 'f': 3}}
    result = config.merge_dicts(a, b)

    assert expected == result
コード例 #11
0
ファイル: test_config.py プロジェクト: xilopix/molecule
def test_merge_dicts():
    # Example taken from python-anyconfig/anyconfig/__init__.py
    a = {'b': [{'c': 0}, {'c': 2}], 'd': {'e': 'aaa', 'f': 3}}
    b = {'a': 1, 'b': [{'c': 3}], 'd': {'e': 'bbb'}}
    expected = {'a': 1, 'b': [{'c': 3}], 'd': {'e': "bbb", 'f': 3}}
    result = config.merge_dicts(a, b)

    assert expected == result
コード例 #12
0
ファイル: conftest.py プロジェクト: kireledan/molecule
def molecule_data(
        molecule_dependency_galaxy_section_data, molecule_driver_section_data,
        molecule_lint_section_data, molecule_platforms_section_data,
        molecule_provisioner_section_data, molecule_scenario_section_data,
        molecule_verifier_section_data):

    fixtures = [
        molecule_dependency_galaxy_section_data, molecule_driver_section_data,
        molecule_lint_section_data, molecule_platforms_section_data,
        molecule_provisioner_section_data, molecule_scenario_section_data,
        molecule_verifier_section_data
    ]

    return functools.reduce(lambda x, y: config.merge_dicts(x, y), fixtures)
コード例 #13
0
def molecule_data(
        molecule_dependency_galaxy_section_data, molecule_driver_section_data,
        molecule_lint_section_data, molecule_platforms_section_data,
        molecule_provisioner_section_data, molecule_scenario_section_data,
        molecule_verifier_section_data):

    fixtures = [
        molecule_dependency_galaxy_section_data, molecule_driver_section_data,
        molecule_lint_section_data, molecule_platforms_section_data,
        molecule_provisioner_section_data, molecule_scenario_section_data,
        molecule_verifier_section_data
    ]

    return functools.reduce(lambda x, y: config.merge_dicts(x, y), fixtures)
コード例 #14
0
    def bake(self):
        """
        Bake ansible-galaxy command so it's ready to execute and returns None.

        :return: None
        """
        requirements_file = self._config['ansible']['requirements_file']
        roles_path = os.path.join(self._config['molecule']['molecule_dir'],
                                  'roles')
        galaxy_default_options = {
            'force': True,
            'role-file': requirements_file,
            'roles-path': roles_path
        }
        galaxy_options = config.merge_dicts(galaxy_default_options,
                                            self._config['ansible']['galaxy'])

        self._galaxy = sh.ansible_galaxy.bake('install',
                                              _env=self._env,
                                              _out=self._out,
                                              _err=self._err,
                                              **galaxy_options)
コード例 #15
0
    def bake(self):
        """
        Bake ansible-galaxy command so it's ready to execute and returns None.

        :return: None
        """
        requirements_file = self._config['dependency']['requirements_file']
        roles_path = os.path.join(self._config['molecule']['molecule_dir'],
                                  'roles')
        galaxy_default_options = {
            'force': True,
            'role-file': requirements_file,
            'roles-path': roles_path
        }
        galaxy_options = config.merge_dicts(
            galaxy_default_options, self._config['dependency']['options'])

        self._galaxy = sh.ansible_galaxy.bake(
            'install',
            _env=self._env,
            _out=self._out,
            _err=self._err,
            **galaxy_options)
コード例 #16
0
    def execute(self):
        """
        Executes linting/integration tests, and returns None.

        Flake8 performs the code linting.
        Testinfra executes integration tests.

        :return: None
        """
        ansible = ansible_playbook.AnsiblePlaybook(
            self._molecule.config.config['ansible'], _env=self._molecule.env)

        testinfra_options = config.merge_dicts(
            self._molecule.driver.testinfra_args,
            self._molecule.verifier_options)
        testinfra_options['env'] = ansible.env
        testinfra_options['debug'] = self._molecule.args.get('--debug', False)
        testinfra_options['sudo'] = self._molecule.args.get('--sudo', False)

        tests_glob = self._get_tests()
        if len(tests_glob) > 0:
            self._flake8(tests_glob)
            self._testinfra(tests_glob, **testinfra_options)
コード例 #17
0
ファイル: test_config.py プロジェクト: kireledan/molecule
def test_merge_dicts_instance_proxies(config_instance):
    a = {'a': 1}
    b = {'b': 2}
    result = config.merge_dicts(a, b)

    assert isinstance(result, dict)
コード例 #18
0
def molecule_vagrant_config(molecule_section_data, vagrant_section_data, ansible_section_data):
    return reduce(
        lambda x, y: config.merge_dicts(x, y), [molecule_section_data, vagrant_section_data, ansible_section_data]
    )
コード例 #19
0
ファイル: conftest.py プロジェクト: holmser/molecule
def molecule_vagrant_config(molecule_section_data, vagrant_section_data,
                            ansible_section_data):
    return reduce(
        lambda x, y: config.merge_dicts(x, y),
        [molecule_section_data, vagrant_section_data, ansible_section_data])
コード例 #20
0
ファイル: test_config.py プロジェクト: neilus/molecule
def test_merge_dicts_instance_proxies(config_instance):
    a = {'a': 1}
    b = {'b': 2}
    result = config.merge_dicts(a, b)

    assert isinstance(result, dict)