forked from osism/ansible-collection-commons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpackages.py
36 lines (25 loc) · 1 KB
/
packages.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
import pytest
from ..util.util import (
get_ansible,
get_variable,
get_os_role_variable,
jinja_list_concat,
)
testinfra_runner, testinfra_hosts = get_ansible()
def test_cleanup_pkg(host):
packages = get_variable(host, "cleanup_packages")
packages_default = get_variable(host, "cleanup_packages_default")
packages_extra = get_variable(host, "cleanup_packages_extra")
packages_distribution = get_os_role_variable(host, "cleanup_packages_distribution")
packages = jinja_list_concat(
packages, [packages_default, packages_extra, packages_distribution]
)
for package_name in packages:
package = host.package(package_name)
assert not package.is_installed
def test_cleanup_cloudimage(host):
if not get_variable(host, "cleanup_cloudinit"):
pytest.skip("cleanup_cloudinit is not True")
package_name = get_os_role_variable(host, "cleanup_cloudinit_package_name")
package = host.package(package_name)
assert not package.is_installed