From f3c160f313c5c5926643ec5b81400b56705705ed Mon Sep 17 00:00:00 2001 From: Andrey Berezin Date: Fri, 27 Oct 2023 14:10:01 +0300 Subject: [PATCH] [#107] Add passwd change protection for local runner --- src/frostfs_testlib/load/runners.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/frostfs_testlib/load/runners.py b/src/frostfs_testlib/load/runners.py index 489ddcd7..b65f1295 100644 --- a/src/frostfs_testlib/load/runners.py +++ b/src/frostfs_testlib/load/runners.py @@ -285,6 +285,7 @@ class LocalRunner(RunnerBase): self.cluster_state_controller = cluster_state_controller self.file_keeper = file_keeper self.loaders = [NodeLoader(node) for node in nodes_under_load] + self.nodes_under_load = nodes_under_load @run_optionally(optionals.OPTIONAL_BACKGROUND_LOAD_ENABLED) @reporter.step_deco("Preparation steps") @@ -301,6 +302,7 @@ class LocalRunner(RunnerBase): with reporter.step("Allow storage user to login into system"): shell.exec(f"sudo chsh -s /bin/bash {STORAGE_USER_NAME}") + shell.exec("sudo chattr +i /etc/passwd") with reporter.step("Update limits.conf"): limits_path = "/etc/security/limits.conf" @@ -381,6 +383,13 @@ class LocalRunner(RunnerBase): for k6_instance in self.k6_instances: k6_instance.stop() + @reporter.step_deco("Restore passwd on {cluster_node}") + def restore_passwd_attr_on_node(cluster_node: ClusterNode): + shell = cluster_node.host.get_shell() + shell.exec("sudo chattr -i /etc/passwd") + + parallel(restore_passwd_attr_on_node, self.nodes_under_load) + self.cluster_state_controller.start_stopped_storage_services() self.cluster_state_controller.start_stopped_s3_gates()