Beispiel #1
0
    def driver(self):
        driver_name = self._get_driver_name()
        driver = None

        if driver_name == 'delegated':
            driver = delegated.Delegated(self)
        elif driver_name == 'docker':
            driver = docker.Docker(self)
        elif driver_name == 'ec2':
            driver = ec2.Ec2(self)
        elif driver_name == 'gce':
            driver = gce.Gce(self)
        elif driver_name == 'lxc':
            driver = lxc.Lxc(self)
        elif driver_name == 'lxd':
            driver = lxd.Lxd(self)
        elif driver_name == 'kvm':
            driver = kvm.kvm(self)
        elif driver_name == 'openstack':
            driver = openstack.Openstack(self)
        elif driver_name == 'vagrant':
            driver = vagrant.Vagrant(self)
        else:
            util.exit_with_invalid_section('driver', driver_name)

        driver.name = driver_name

        return driver
Beispiel #2
0
    def driver(self):
        driver_name = self._get_driver_name()
        driver = None

        if driver_name == 'docker':
            driver = dockr.Dockr(self)
        elif driver_name == 'ec2':
            driver = ec2.Ec2(self)
        elif driver_name == 'gce':
            driver = gce.Gce(self)
        elif driver_name == 'lxc':
            driver = lxc.Lxc(self)
        elif driver_name == 'lxd':
            driver = lxd.Lxd(self)
        elif driver_name == 'openstack':
            driver = openstack.Openstack(self)
        elif driver_name == 'static':
            driver = static.Static(self)
        elif driver_name == 'vagrant':
            driver = vagrant.Vagrant(self)
        else:
            util.exit_with_invalid_section('driver', driver_name)

        driver.name = driver_name

        return driver
Beispiel #3
0
 def verifier(self):
     verifier_name = self.config['verifier']['name']
     if verifier_name == 'testinfra':
         return testinfra.Testinfra(self)
     elif verifier_name == 'goss':
         return goss.Goss(self)
     else:
         util.exit_with_invalid_section('verifier', verifier_name)
Beispiel #4
0
 def dependency(self):
     dependency_name = self.config['dependency']['name']
     if dependency_name == 'galaxy':
         return ansible_galaxy.AnsibleGalaxy(self)
     elif dependency_name == 'gilt':
         return gilt.Gilt(self)
     else:
         util.exit_with_invalid_section('dependency', dependency_name)
Beispiel #5
0
def test_exit_with_invalid_section(patched_logger_critical):
    with pytest.raises(SystemExit) as e:
        util.exit_with_invalid_section('section', 'name')

    assert 1 == e.value.code

    msg = "Invalid section named 'name' configured."
    patched_logger_critical.assert_called_once_with(msg)
Beispiel #6
0
def test_exit_with_invalid_section(patched_logger_critical):
    with pytest.raises(SystemExit) as e:
        util.exit_with_invalid_section('section', 'name')

    assert 1 == e.value.code

    msg = "Invalid section named 'name' configured."
    patched_logger_critical.assert_called_once_with(msg)
Beispiel #7
0
 def verifier(self):
     verifier_name = self.config['verifier']['name']
     if verifier_name == 'testinfra':
         return testinfra.Testinfra(self)
     elif verifier_name == 'goss':
         return goss.Goss(self)
     else:
         util.exit_with_invalid_section('verifier', verifier_name)
Beispiel #8
0
 def dependency(self):
     dependency_name = self.config['dependency']['name']
     if dependency_name == 'galaxy':
         return ansible_galaxy.AnsibleGalaxy(self)
     elif dependency_name == 'gilt':
         return gilt.Gilt(self)
     else:
         util.exit_with_invalid_section('dependency', dependency_name)
Beispiel #9
0
 def lint(self):
     lint_name = self._config.config['verifier']['lint']['name']
     if lint_name == 'flake8':
         return flake8.Flake8(self._config)
     elif lint_name == 'None':
         return
     else:
         util.exit_with_invalid_section('lint', lint_name)
Beispiel #10
0
 def provisioner(self):
     provisioner_name = self.config['provisioner']['name']
     if provisioner_name == 'ansible':
         return ansible.Ansible(self)
     else:
         util.exit_with_invalid_section('provisioner', provisioner_name)
Beispiel #11
0
 def lint(self):
     lint_name = self.config['lint']['name']
     if lint_name == 'yamllint':
         return yamllint.Yamllint(self)
     else:
         util.exit_with_invalid_section('lint', lint_name)
Beispiel #12
0
 def provisioner(self):
     provisioner_name = self.config['provisioner']['name']
     if provisioner_name == 'ansible':
         return ansible.Ansible(self)
     else:
         util.exit_with_invalid_section('provisioner', provisioner_name)
Beispiel #13
0
 def lint(self):
     lint_name = self.config['lint']['name']
     if lint_name == 'yamllint':
         return yamllint.Yamllint(self)
     else:
         util.exit_with_invalid_section('lint', lint_name)
Beispiel #14
0
 def lint(self):
     lint_name = self._config.config['provisioner']['lint']['name']
     if lint_name == 'ansible-lint':
         return ansible_lint.AnsibleLint(self._config)
     else:
         util.exit_with_invalid_section('lint', lint_name)