Skip to content
Snippets Groups Projects
Commit a56ae486 authored by nimrod's avatar nimrod
Browse files

- Use SystemInfo to determine to OS type (instead of using the facts from the...

- Use SystemInfo to determine to OS type (instead of using the facts from the Ansbile module and the Testinfra backend module, which is just ugly code).
parent dc93bc23
No related branches found
No related tags found
No related merge requests found
...@@ -16,31 +16,31 @@ def test_unbound_socket(Socket): ...@@ -16,31 +16,31 @@ def test_unbound_socket(Socket):
assert Socket('udp://127.0.0.1:53').is_listening assert Socket('udp://127.0.0.1:53').is_listening
def test_unbound_conf_d(File, Ansible): def test_unbound_conf_d(File, SystemInfo):
ansible_os_family = Ansible('setup')['ansible_facts']['ansible_os_family'] if SystemInfo.type == 'openbsd':
if ansible_os_family == 'OpenBSD':
assert 'include: "/var/unbound/etc/unbound.conf.d/*.conf"' in File( assert 'include: "/var/unbound/etc/unbound.conf.d/*.conf"' in File(
'/var/unbound/etc/unbound.conf').content_string '/var/unbound/etc/unbound.conf').content_string
assert File('/var/unbound/etc/unbound.conf.d').is_directory assert File('/var/unbound/etc/unbound.conf.d').is_directory
elif ansible_os_family == 'Debian': elif SystemInfo.type == 'linux' and SystemInfo.distribution in ['debian',
'ubuntu']:
assert 'include: "/etc/unbound/unbound.conf.d/*.conf"' in File( assert 'include: "/etc/unbound/unbound.conf.d/*.conf"' in File(
'/etc/unbound/unbound.conf').content_string '/etc/unbound/unbound.conf').content_string
assert File('/etc/unbound/unbound.conf.d').is_directory assert File('/etc/unbound/unbound.conf.d').is_directory
def test_unbound_trust_anchor(Ansible, File): def test_unbound_trust_anchor(SystemInfo, File):
ansible_os_family = Ansible('setup')['ansible_facts']['ansible_os_family'] if SystemInfo.type == 'openbsd':
if ansible_os_family == 'OpenBSD':
assert File('/var/unbound/etc/root.key').exists assert File('/var/unbound/etc/root.key').exists
elif ansible_os_family == 'Debian': elif SystemInfo.type == 'linux' and SystemInfo.distribution in ['debian',
'ubuntu']:
assert File('/etc/unbound/root.key').exists assert File('/etc/unbound/root.key').exists
def test_unbound_user(Ansible, User, File): def test_unbound_user(SystemInfo, User, File):
ansible_os_family = Ansible('setup')['ansible_facts']['ansible_os_family'] if SystemInfo.type == 'openbsd':
if ansible_os_family == 'OpenBSD':
assert User('_unbound').exists assert User('_unbound').exists
assert File('/etc/mail/aliases').contains('_unbound: root') assert File('/etc/mail/aliases').contains('_unbound: root')
elif ansible_os_family == 'Debian': elif SystemInfo.type == 'linux' and SystemInfo.distribution in ['debian',
'ubuntu']:
assert User('unbound').exists assert User('unbound').exists
assert File('/etc/aliases').contains('unbound: root') assert File('/etc/aliases').contains('unbound: root')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment