Skip to content
Snippets Groups Projects
Commit bf50f707 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 feccf7d8
No related branches found
No related tags found
No related merge requests found
......@@ -13,20 +13,21 @@ def test_nsd_service(Service, Sudo):
pass
def test_nsd_config(Command, File, Ansible):
if Ansible('setup')['ansible_facts']['ansible_os_family'] == 'OpenBSD':
def test_nsd_config(Command, File, SystemInfo):
if SystemInfo.type == 'openbsd':
assert Command('nsd-checkconf /var/nsd/etc/nsd.conf')
elif Ansible('setup')['ansible_facts']['ansible_os_family'] == 'Debian':
elif SystemInfo.type == 'linux' and SystemInfo.distribution in ['debian',
'ubuntu']:
assert Command('nsd-checkconf /etc/nsd/nsd.conf')
def test_nsd_directories(File, Ansible, Sudo):
ansible_os_family = Ansible('setup')['ansible_facts']['ansible_os_family']
if ansible_os_family == 'OpenBSD':
def test_nsd_directories(File, SystemInfo, Sudo):
if SystemInfo.type == 'openbsd':
with Sudo():
assert File('/var/nsd/etc/nsd.conf.d').is_directory
assert File('/var/nsd/zones').is_directory
elif ansible_os_family == 'Debian':
elif SystemInfo.type == 'linux' and SystemInfo.distribution in ['debian',
'ubuntu']:
assert File('/etc/nsd/nsd.conf.d').is_directory
assert File('/etc/nsd').is_directory
......@@ -39,11 +40,11 @@ def test_nsd_test_zone(Command):
assert '127.0.0.2' in Command('dig @127.0.0.1 a.testzone').stdout
def test_nsd_alias(File, Ansible, User):
ansible_os_family = Ansible('setup')['ansible_facts']['ansible_os_family']
if ansible_os_family == 'Debian':
assert User('nsd').exists
assert File('/etc/aliases').contains('nsd: root')
elif ansible_os_family == 'OpenBSD':
def test_nsd_alias(File, SystemInfo, User):
if SystemInfo.type == 'openbsd':
assert User('_nsd').exists
assert File('/etc/mail/aliases').contains('_nsd: root')
elif SystemInfo.type == 'linux' and SystemInfo.distribution in ['debian',
'ubuntu']:
assert User('nsd').exists
assert File('/etc/aliases').contains('nsd: root')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment