Blame SOURCES/wla-Fixed-faulty-check-for-run_command-2093.patch

4420af
From 51ff3dc6705217f52e4b4810fa9b6eac406ca84e Mon Sep 17 00:00:00 2001
4420af
From: Vitaly Kuznetsov <vkuznets@redhat.com>
4420af
Date: Thu, 17 Dec 2020 06:50:11 +0100
4420af
Subject: [PATCH] Fixed faulty check for run_command (#2093)
4420af
4420af
RH-Author: Vitaly Kuznetsov <vkuznets@redhat.com>
4420af
Message-id: <20201209101549.2667108-1-vkuznets@redhat.com>
4420af
Patchwork-id: 100366
4420af
O-Subject: [RHEL8 WALinuxAgent PATCH] Fixed faulty check for run_command (#2093)
4420af
Bugzilla: 1903074
4420af
RH-Acked-by: Cathy Avery <cavery@redhat.com>
4420af
RH-Acked-by: Mohammed Gamal <mgamal@redhat.com>
4420af
4420af
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1903074
4420af
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=33563215
4420af
Tested: by QE
4420af
Branch: rhel840/master-2.2.49
4420af
4420af
commit b1799aef33f1213ef8828d5ba1838582026d5030
4420af
Author: Laveesh Rohra <larohra@microsoft.com>
4420af
Date:   Tue Dec 1 16:13:03 2020 -0800
4420af
4420af
    Fixed faulty check for run_command (#2093)
4420af
4420af
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
4420af
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4420af
---
4420af
 azurelinuxagent/common/osutil/redhat.py | 5 ++++-
4420af
 azurelinuxagent/common/osutil/suse.py   | 2 +-
4420af
 2 files changed, 5 insertions(+), 2 deletions(-)
4420af
4420af
diff --git a/azurelinuxagent/common/osutil/redhat.py b/azurelinuxagent/common/osutil/redhat.py
4420af
index 8974ecc..1b3ae0e 100644
4420af
--- a/azurelinuxagent/common/osutil/redhat.py
4420af
+++ b/azurelinuxagent/common/osutil/redhat.py
4420af
@@ -106,7 +106,10 @@ class RedhatOSUtil(Redhat6xOSUtil):
4420af
         to hostname.
4420af
         """
4420af
         hostnamectl_cmd = ['hostnamectl', 'set-hostname', hostname, '--static']
4420af
-        if self._run_command_without_raising(hostnamectl_cmd, log_error=False) != 0:
4420af
+
4420af
+        try:
4420af
+            shellutil.run_command(hostnamectl_cmd, log_error=False)
4420af
+        except shellutil.CommandError:
4420af
             logger.warn("[{0}] failed, attempting fallback".format(' '.join(hostnamectl_cmd)))
4420af
             DefaultOSUtil.set_hostname(self, hostname)
4420af
 
4420af
diff --git a/azurelinuxagent/common/osutil/suse.py b/azurelinuxagent/common/osutil/suse.py
4420af
index 2192c67..0b5fc8d 100644
4420af
--- a/azurelinuxagent/common/osutil/suse.py
4420af
+++ b/azurelinuxagent/common/osutil/suse.py
4420af
@@ -80,7 +80,7 @@ class SUSEOSUtil(SUSE11OSUtil):
4420af
         self._run_command_without_raising(["systemctl", "start", "{}.service".format(self.dhclient_name)],
4420af
                                           log_error=False)
4420af
 
4420af
-    def start_network(self) :
4420af
+    def start_network(self):
4420af
         self._run_command_without_raising(["systemctl", "start", "network.service"], log_error=False)
4420af
 
4420af
     def restart_ssh_service(self):
4420af
-- 
4420af
2.18.4
4420af