Test puppet is installed on base

We need to be able to install puppet in our base ansible as part of the
transition from puppet to other management. Test using testinfra that
our base ansible playbook does install puppet.

Change-Id: I3a080a0717483a0885fefb329a168dd438eb9854
This commit is contained in:
Clark Boylan 2018-08-28 10:48:34 -07:00
parent 7bd8117e2a
commit 60d31fc636
1 changed files with 18 additions and 0 deletions

View File

@ -37,6 +37,24 @@ def test_exim_is_installed(host):
assert cmd.rc == 0
def test_puppet(host):
# We only install puppet on trusty, xenial and centos 7
if (host.system_info.codename in ['trusty', 'xenial'] or
host.system_info.distribution in ['centos']):
# Package name differs depending on puppet release version
# just check one version of puppet is installed.
puppet = host.package("puppet")
puppet_agent = host.package("puppet-agent")
assert puppet.is_installed or puppet_agent.is_installed
service = host.service("puppet")
assert not service.is_running
assert not service.is_enabled
else:
puppet = host.package("puppet")
puppet_agent = host.package("puppet-agent")
assert not puppet.is_installed and not puppet_agent.is_installed
def test_iptables(host):
rules = host.iptables.rules()
rules = [x.strip() for x in rules]