ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aonis...@apache.org
Subject git commit: AMBARI-7058. Improve logging on Ubuntu on package install failure. (aonishuk)
Date Thu, 28 Aug 2014 15:05:18 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 6b7e796ab -> 1b017b7cd


AMBARI-7058. Improve logging on Ubuntu on package install failure. (aonishuk)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1b017b7c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1b017b7c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1b017b7c

Branch: refs/heads/trunk
Commit: 1b017b7cd4b4f8fbd89beaf7b1adf8bf9eaac3a2
Parents: 6b7e796
Author: Andrew Onishuk <aonishuk@hortonworks.com>
Authored: Thu Aug 28 18:05:09 2014 +0300
Committer: Andrew Onishuk <aonishuk@hortonworks.com>
Committed: Thu Aug 28 18:05:09 2014 +0300

----------------------------------------------------------------------
 .../python/resource_management/TestPackageResource.py    |  6 +++---
 .../resource_management/core/providers/package/apt.py    | 11 ++++++++---
 2 files changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1b017b7c/ambari-agent/src/test/python/resource_management/TestPackageResource.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/resource_management/TestPackageResource.py b/ambari-agent/src/test/python/resource_management/TestPackageResource.py
index d36c543..1628322 100644
--- a/ambari-agent/src/test/python/resource_management/TestPackageResource.py
+++ b/ambari-agent/src/test/python/resource_management/TestPackageResource.py
@@ -36,11 +36,11 @@ class TestPackageResource(TestCase):
       )
     call_mock.assert_has_calls([call("dpkg --get-selections some_package | grep -v deinstall"),
                                 call("DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get -q
-o Dpkg::Options::='--force-confdef'"
-                                      " --allow-unauthenticated --assume-yes install some_package")
+                                      " --allow-unauthenticated --assume-yes install some_package"),
+                                call("apt-get update -qq")
                               ])
     
-    shell_mock.assert_has_calls([call("apt-get update -qq"),
-                                call("DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get -q
-o Dpkg::Options::='--force-confdef' --allow-unauthenticated --assume-yes install some_package")
+    shell_mock.assert_has_calls([call("DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get -q
-o Dpkg::Options::='--force-confdef' --allow-unauthenticated --assume-yes install some_package")
                               ])
   
   @patch.object(shell, "call")

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b017b7c/ambari-common/src/main/python/resource_management/core/providers/package/apt.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/core/providers/package/apt.py
b/ambari-common/src/main/python/resource_management/core/providers/package/apt.py
index 4c6e2dd..f001f14 100644
--- a/ambari-common/src/main/python/resource_management/core/providers/package/apt.py
+++ b/ambari-common/src/main/python/resource_management/core/providers/package/apt.py
@@ -33,12 +33,17 @@ class AptProvider(PackageProvider):
     if not self._check_existence(name):
       cmd = INSTALL_CMD % (name)
       Logger.info("Installing package %s ('%s')" % (name, cmd))
-      code = shell.call(cmd)[0]
+      code, out = shell.call(cmd)
       
       # apt-get update wasn't done too long
       if code:
-        Logger.info("Failed to install package %s. Executing `apt-get update`" % (name))
-        shell.checked_call(REPO_UPDATE_CMD)
+        Logger.info("Execution of '%s' returned %d. %s" % (cmd, code, out))
+        Logger.info("Failed to install package %s. Executing `%s`" % (name, REPO_UPDATE_CMD))
+        code, out = shell.call(REPO_UPDATE_CMD)
+        
+        if code:
+          Logger.info("Execution of '%s' returned %d. %s" % (REPO_UPDATE_CMD, code, out))
+          
         Logger.info("Retrying to install package %s" % (name))
         shell.checked_call(cmd)
     else:


Mime
View raw message