From 350b0df3bfec90728cd1c4059ff60b04caf1987a Mon Sep 17 00:00:00 2001 From: reyesj2 <94730068+reyesj2@users.noreply.github.com> Date: Mon, 22 Jan 2024 22:48:15 -0500 Subject: [PATCH] Handle non-zero Signed-off-by: reyesj2 <94730068+reyesj2@users.noreply.github.com> --- salt/common/tools/sbin/so-common-status-check | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/salt/common/tools/sbin/so-common-status-check b/salt/common/tools/sbin/so-common-status-check index b073eb457f..39e0c16a77 100644 --- a/salt/common/tools/sbin/so-common-status-check +++ b/salt/common/tools/sbin/so-common-status-check @@ -40,15 +40,15 @@ def check_needs_restarted(): def check_for_fips(): fips = 0 try: - result = subprocess.run(['fips-mode-setup', '--is-enabled'], check=True, stdout=subprocess.PIPE) - fips = int(result.returncode == 0) + result = subprocess.run(['fips-mode-setup', '--is-enabled'], stdout=subprocess.PIPE) + if result.returncode == 0: + fips = 1 except FileNotFoundError: with open('/proc/sys/crypto/fips_enabled', 'r') as f: contents = f.read() if '1' in contents: fips = 1 - else: - fips = 0 + with open('/opt/so/log/sostatus/fips_enabled', 'w') as f: f.write(str(fips)) @@ -61,8 +61,9 @@ def check_for_luks(): for gc in device['children']: if 'children' in gc: try: - result = subprocess.run(['cryptsetup', 'isLuks', gc['name']], check=True, stdout=subprocess.PIPE) - luks = int(result.returncode == 0) + result = subprocess.run(['cryptsetup', 'isLuks', gc['name']], stdout=subprocess.PIPE) + if result.returncode == 0: + luks = 1 except FileNotFoundError: for ggc in gc['children']: if 'crypt' in ggc['type']: