You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ha...@apache.org on 2018/04/27 13:59:08 UTC

[ambari] branch trunk updated: AMBARI-23689 Installing Packages Fails Silently When Dependencies Are Not Resolved (dgrinenko)

This is an automated email from the ASF dual-hosted git repository.

hapylestat pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 76d4e31  AMBARI-23689 Installing Packages Fails Silently When Dependencies Are Not Resolved (dgrinenko)
76d4e31 is described below

commit 76d4e315158f144ff6bf138d8056aed59363d4c6
Author: Dmitry Grinenko <ha...@gmail.com>
AuthorDate: Fri Apr 27 15:30:34 2018 +0300

    AMBARI-23689 Installing Packages Fails Silently When Dependencies Are Not Resolved (dgrinenko)
---
 ambari-common/src/main/python/ambari_commons/shell.py     |  5 +++--
 .../resources/custom_actions/scripts/install_packages.py  | 15 ++++++++++-----
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/ambari-common/src/main/python/ambari_commons/shell.py b/ambari-common/src/main/python/ambari_commons/shell.py
index d387837..c5cc247 100644
--- a/ambari-common/src/main/python/ambari_commons/shell.py
+++ b/ambari-common/src/main/python/ambari_commons/shell.py
@@ -739,8 +739,9 @@ def repository_manager_executor(cmd, repo_properties, context=RepoCallContext(),
 
     should_stop_retries = __handle_retries(cmd, repo_properties, context, call_result, is_first_time, is_last_time)
     if (is_last_time or should_stop_retries) and call_result.code != 0:
-      message = "Failed to execute command '{0}', exited with code '{1}' with message: {2}".format(
-        cmd, call_result.code, call_result.error)
+      message = "Failed to execute command '{0}', exited with code '{1}', message: '{2}'".format(
+        cmd if not isinstance(cmd, (list, tuple)) else " ".join(cmd),
+        call_result.code, call_result.error)
 
       if context.ignore_errors:
         _logger.warning(message)
diff --git a/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py b/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py
index 80af147..92cfc58 100644
--- a/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py
+++ b/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py
@@ -396,6 +396,7 @@ class InstallPackages(Script):
           repos_to_use[repo_id] = self.repo_files[repo_id]
 
       self.repo_mgr.upgrade_package(stack_selector_package, RepoCallContext(
+        ignore_errors=False,
         use_repos=repos_to_use,
         retry_on_repo_unavailability=agent_stack_retry_on_unavailability,
         retry_count=agent_stack_retry_count))
@@ -408,18 +409,22 @@ class InstallPackages(Script):
         available_packages_in_repos = self.repo_mgr.get_available_packages_in_repos(command_repos)
       except Exception:
         available_packages_in_repos = []
+
+      installation_context = RepoCallContext(
+        ignore_errors=False,
+        retry_on_repo_unavailability=agent_stack_retry_on_unavailability,
+        retry_count=agent_stack_retry_count
+      )
+
       for package in filtered_package_list:
         name = self.get_package_from_available(package['name'], available_packages_in_repos)
 
         # This enables upgrading non-versioned packages, despite the fact they exist.
         # Needed by 'mahout' which is non-version but have to be updated
-        self.repo_mgr.upgrade_package(name, RepoCallContext(
-          retry_on_repo_unavailability=agent_stack_retry_on_unavailability,
-          retry_count=agent_stack_retry_count
-        ))
+        self.repo_mgr.upgrade_package(name, installation_context)
     except Exception as err:
       ret_code = 1
-      Logger.logger.exception("Package Manager failed to install packages. Error: {0}".format(str(err)))
+      Logger.logger.error("Package Manager failed to install packages: {0}".format(str(err)))
 
       # Remove already installed packages in case of fail
       if packages_were_checked and packages_installed_before:

-- 
To stop receiving notification emails like this one, please contact
hapylestat@apache.org.