diff --git a/linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_passwords_pam_tally2_file/tests/pam_tally2_file_default.fail.sh b/linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_passwords_pam_tally2_file/tests/pam_tally2_file_default.fail.sh index 583c8e85059..0349db0252c 100644 --- a/linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_passwords_pam_tally2_file/tests/pam_tally2_file_default.fail.sh +++ b/linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_passwords_pam_tally2_file/tests/pam_tally2_file_default.fail.sh @@ -1,5 +1,5 @@ #!/bin/bash -# platform = multi_platform_slmicro5 +# platform = multi_platform_slmicro cat >/etc/pam.d/common-account </etc/pam.d/common-account </etc/pam.d/common-account < argparse.Namespace: parser = argparse.ArgumentParser() @@ -32,8 +38,17 @@ def _test_filename_valid(test_file: str) -> bool: return True +def _validate_platform(param_value, test_file): + for platform in param_value.split(","): + if platform.strip() not in VALID_PLATFORMS: + print(f"Invalid platform '{platform}' in {test_file}", file=sys.stderr) + return False + return True + + def _has_invalid_param(root: str, test_file: str) -> bool: full_path = os.path.join(root, test_file) + has_no_errors = True with open(full_path, "r") as f: for line in f: if not line.startswith("#"): @@ -44,10 +59,13 @@ def _has_invalid_param(root: str, test_file: str) -> bool: if len(parts) != 2: continue param_name = parts[0].strip() + param_value = parts[1].strip() + if param_name == 'platform': + has_no_errors = _validate_platform(param_value, test_file) if param_name not in VALID_FIELDS: print(f"Invalid field '{param_name}' in {test_file}", file=sys.stderr) - return False - return True + has_no_errors = False + return has_no_errors def main() -> int: