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

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