Skip to content

Commit

Permalink
refactor check_paas.py (#83)
Browse files Browse the repository at this point in the history
Co-authored-by: iala0219 <iaroslav.lakhtachev@netcracker.com>
  • Loading branch information
Yaroslav-Lahtachev and Yaroslav-Lahtachev authored Dec 23, 2021
1 parent b620584 commit 4cb662c
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions kubetool/procedures/check_paas.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def recommended_system_packages_versions(cluster):

if bad_results:
raise TestWarn("detected not recommended packages versions",
hint=f'Check the list of recommended packages and what is listed in the inventory and fix'
hint=f'Check the list of recommended packages and what is listed in the inventory and fix '
f'the inconsistencies of the following packages on the system: {bad_results}')
cluster.log.debug(f"found packages: {good_results}")
tc.success("all packages have recommended versions")
Expand Down Expand Up @@ -575,13 +575,16 @@ def verify_selinux_status(cluster: KubernetesCluster) -> None:
permissive_ips = []
bad_ips = []
for conn, results in selinux_parsed_result.items():
if results['mode'] == 'enforcing':
enforcing_ips.append(conn.host)
elif results['mode'] == 'permissive' and cluster.inventory.get('services', {})\
.get('kernel_security', {}).get('selinux', {}).get('state') == 'permissive':
permissive_ips.append(conn.host)
if results.get('status', '') != 'disabled':
if results['mode'] == 'enforcing':
enforcing_ips.append(conn.host)
elif results['mode'] == 'permissive' and cluster.inventory.get('services', {})\
.get('kernel_security', {}).get('selinux', {}).get('state') == 'permissive':
permissive_ips.append(conn.host)
else:
bad_ips.append([conn.host, results['mode']])
else:
bad_ips.append([conn.host, results['mode']])
bad_ips.append([conn.host, 'disabled'])

if group.nodes_amount() == len(enforcing_ips):
tc.success(results='enforcing')
Expand Down

0 comments on commit 4cb662c

Please sign in to comment.