You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jo...@apache.org on 2019/07/22 17:37:22 UTC

[ambari] branch branch-2.7 updated: AMBARI-25338 : FatalException with incorrect argument call (branch-2.7) (#3053)

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

jonathanhurley pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.7 by this push:
     new d70aed9  AMBARI-25338 : FatalException with incorrect argument call (branch-2.7) (#3053)
d70aed9 is described below

commit d70aed98cc2b92bbe32994203c57400404bf2c89
Author: Viraj Jasani <34...@users.noreply.github.com>
AuthorDate: Mon Jul 22 23:07:14 2019 +0530

    AMBARI-25338 : FatalException with incorrect argument call (branch-2.7) (#3053)
---
 ambari-server/src/main/python/ambari_server/setupMpacks.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/ambari-server/src/main/python/ambari_server/setupMpacks.py b/ambari-server/src/main/python/ambari_server/setupMpacks.py
index b8c0974..9bb6b77 100755
--- a/ambari-server/src/main/python/ambari_server/setupMpacks.py
+++ b/ambari-server/src/main/python/ambari_server/setupMpacks.py
@@ -821,6 +821,7 @@ def _install_mpack(options, replay_mode=False, is_upgrade=False):
 
   print_info_msg("Management pack {0}-{1} successfully installed! Please restart ambari-server.".format(mpack_name, mpack_version))
   return mpack_metadata, mpack_name, mpack_version, mpack_staging_dir, mpack_archive_path
+
 # TODO
 def _execute_hook(mpack_metadata, hook_name, base_dir):
   if "hooks" in mpack_metadata:
@@ -830,23 +831,24 @@ def _execute_hook(mpack_metadata, hook_name, base_dir):
         hook_script = os.path.join(base_dir, hook.script)
         if os.path.exists(hook_script):
           print_info_msg("Executing {0} hook script : {1}".format(hook_name, hook_script))
-          command = []
           if hook.type == PYTHON_HOOK_TYPE:
             command = ["/usr/bin/ambari-python-wrap", hook_script]
           elif hook.type == SHELL_HOOK_TYPE:
             command = ["/bin/bash", hook_script]
           else:
-            raise FatalException("Malformed management pack. Unknown hook type for {0} hook script".format(hook_name))
+            raise FatalException(-1, "Malformed management pack. Unknown hook type for {0} hook script"
+                                 .format(hook_name))
           (returncode, stdoutdata, stderrdata) = run_os_command(command)
           if returncode != 0:
             msg = "Failed to execute {0} hook. Failed with error code {0}".format(hook_name, returncode)
             print_error_msg(msg)
             print_error_msg(stderrdata)
-            raise FatalException(msg)
+            raise FatalException(-1, msg)
           else:
             print_info_msg(stdoutdata)
         else:
-          raise FatalException("Malformed management pack. Missing {0} hook script {1}".format(hook_name, hook_script))
+          raise FatalException(-1, "Malformed management pack. Missing {0} hook script {1}"
+                               .format(hook_name, hook_script))
 
 def get_replay_log_file():
   """