[#107] Add passwd change protection for local runner

This commit is contained in:
Andrey Berezin 2023-10-27 14:10:01 +03:00
parent 8a360683ae
commit b731fc73bc

View file

@ -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()