From b3d1075ee6306a7290b92e001846952ca6aad73c Mon Sep 17 00:00:00 2001 From: Georgios Kyratsas Date: Thu, 19 Mar 2020 11:53:13 +0100 Subject: [PATCH] qa/tasks/salt_manager.py: Add Update fuction Adding all_minions_zypper_up_if_needed that performs any pending updates on the hosts Signed-off-by: Georgios Kyratsas --- qa/tasks/salt_manager.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/qa/tasks/salt_manager.py b/qa/tasks/salt_manager.py index f769f0fcdf748a..1cc3e4916cabd2 100644 --- a/qa/tasks/salt_manager.py +++ b/qa/tasks/salt_manager.py @@ -132,6 +132,16 @@ def all_minions_zypper_status(self): self.all_minions_zypper_lu() self.all_minions_zypper_ps() + def all_minions_zypper_up_if_needed(self): + """ + List updates and perform update if needed + """ + zypper_lu = "sudo salt \\* cmd.run \'zypper lu || true\' 2>/dev/null" + zypper_up = "sudo zypper -n up || true\' 2>/dev/null" + output = self.master_remote.sh(zypper_lu) + if 'Nothing to do' not in output: + self.all_minions_cmd_run(zypper_up) + def cat_salt_master_conf(self): self.__cat_file_remote(self.master_remote, filename="/etc/salt/master")