Skip to content

Commit 8eb8d25

Browse files
hanwen-clusterhanwen-pcluste
authored andcommitted
[Integ-tests] Use right permission to operate on log files
In many of the operating systems ParallelCluster supported, `root` user could bypass any files permissions. However, with RHEL9 and Rocky9, `root` user could not bypass files permissions by default. Therefore, this commit improves integration tests to operate on files with the owner users of the files Signed-off-by: Hanwen <hanwenli@amazon.com>
1 parent 1d29020 commit 8eb8d25

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tests/integration-tests/tests/basic/log_rotation_utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,11 @@ def _test_logs_uploaded_to_cloudwatch(
179179
# write a log message to log file after log rotation in case log is empty
180180
for log in logs:
181181
if log.get("existence"):
182+
log_path = log.get("log_path")
183+
log_file_user = remote_command_executor.get_user_to_operate_on_file(log_path)
182184
_run_command_on_node(
183185
remote_command_executor,
184-
f"echo '{after_log_rotation_message}' | sudo tee --append {log.get('log_path')}",
186+
f"echo '{after_log_rotation_message}' | sudo -u {log_file_user} tee --append {log_path}",
185187
compute_private_ip,
186188
)
187189
# assert both logs are in the cloudwatch logs

0 commit comments

Comments
 (0)