forked from osism/ansible-collection-services
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathredhat.py
44 lines (30 loc) · 1.02 KB
/
redhat.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import pytest
from ..util.util import get_ansible, get_variable
testinfra_runner, testinfra_hosts = get_ansible()
def check_ansible_os_family(host):
if get_variable(host, "ansible_os_family", True) != "RedHat":
pytest.skip("ansible_os_family mismatch")
def test_pkg(host):
check_ansible_os_family(host)
package = host.package("epel-release")
assert package.is_installed
package = host.package("hddtemp")
assert package.is_installed
def test_configfile(host):
check_ansible_os_family(host)
f = host.file("/etc/sysconfig/hddtemp")
assert f.exists
assert not f.is_directory
assert f.user == "root"
assert f.group == "root"
assert f.mode == 0o644
assert (
"--listen 127.0.0.1 --daemon --port 7634 --syslog=1 /dev/sd[a-z] /dev/sd[a-z][a-z]"
in f.content_string
)
def test_srv(host):
check_ansible_os_family(host)
service_name = "hddtemp"
service = host.service(service_name)
assert service.is_enabled
assert service.is_running