You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ao...@apache.org on 2016/09/26 15:18:40 UTC
ambari git commit: AMBARI-18465. Log results from shell commands run
as user (aonishuk)
Repository: ambari
Updated Branches:
refs/heads/trunk 5a29d4866 -> 8192601df
AMBARI-18465. Log results from shell commands run as user (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8192601d
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8192601d
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8192601d
Branch: refs/heads/trunk
Commit: 8192601dfa606e72084813969b7de5af39bd083d
Parents: 5a29d48
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Mon Sep 26 18:18:34 2016 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Mon Sep 26 18:18:34 2016 +0300
----------------------------------------------------------------------
.../libraries/functions/get_user_call_output.py | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/8192601d/ambari-common/src/main/python/resource_management/libraries/functions/get_user_call_output.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/get_user_call_output.py b/ambari-common/src/main/python/resource_management/libraries/functions/get_user_call_output.py
index 4b11614..e0723c6 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/get_user_call_output.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/get_user_call_output.py
@@ -21,6 +21,7 @@ Ambari Agent
"""
import os
+import sys
import tempfile
from resource_management.core import shell
from resource_management.core.logger import Logger
@@ -60,9 +61,17 @@ def get_user_call_output(command, user, quiet=False, is_checked_call=True, **cal
if is_checked_call:
raise Fail(err_msg)
else:
- Logger.warning(err_msg)
+ Logger.warning(err_msg)
+
+ result = code, files_output[0], files_output[1]
- return code, files_output[0], files_output[1]
+ caller_filename = sys._getframe(1).f_code.co_filename
+ is_internal_call = shell.NOT_LOGGED_FOLDER in caller_filename
+ if quiet == False or (quiet == None and not is_internal_call):
+ log_msg = "{0} returned {1}".format(get_user_call_output.__name__, result)
+ Logger.info(log_msg)
+
+ return result
finally:
for f in out_files:
f.close()