コード例 #1
0
    def test_render_command(self):
        """
        Run the render_sandbox_creation_command function
        """

        run_playbook_command = ansible.render_sandbox_creation_command(
            requirements_path='/requirements/path.txt',
            inventory_path="/tmp/inventory/path",
            vars_path="/tmp/vars/path",
            playbook_name='playbook_name',
            remote_username="******",
            venv_path='/tmp/venv')
        expected = (
            'virtualenv -p /usr/bin/python /tmp/venv && '
            '/tmp/venv/bin/python -u /tmp/venv/bin/pip install -r /requirements/path.txt && '
            '/tmp/venv/bin/python -u /tmp/venv/bin/ansible-playbook -i /tmp/inventory/path '
            '-e @/tmp/vars/path -u root playbook_name')

        self.assertEqual(expected, run_playbook_command)
コード例 #2
0
ファイル: test_ansible.py プロジェクト: antoviaque/opencraft
    def test_render_command(self):
        """
        Run the render_sandbox_creation_command function
        """

        run_playbook_command = ansible.render_sandbox_creation_command(
            requirements_path='/requirements/path.txt',
            inventory_path="/tmp/inventory/path",
            vars_path="/tmp/vars/path",
            playbook_name='playbook_name',
            remote_username="******",
            venv_path='/tmp/venv'
        )
        expected = (
            'virtualenv -p /usr/bin/python /tmp/venv && '
            '/tmp/venv/bin/python -u /tmp/venv/bin/pip install -r /requirements/path.txt && '
            '/tmp/venv/bin/python -u /tmp/venv/bin/ansible-playbook -i /tmp/inventory/path '
            '-e @/tmp/vars/path -u root playbook_name'
        )

        self.assertEqual(expected, run_playbook_command)