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

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