This is an automated email from the ASF dual-hosted git repository.
jialiang 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 616e48363d AMBARI-26094: Enhance error logging for run function in
Ambari shell script (#3794)
616e48363d is described below
commit 616e48363d338f832a2bb0435348900cecf495c9
Author: jialiang <[email protected]>
AuthorDate: Tue Jul 30 09:05:12 2024 +0800
AMBARI-26094: Enhance error logging for run function in Ambari shell script
(#3794)
Co-authored-by: jialiang <[email protected]>
---
ambari-common/src/main/python/ambari_commons/shell.py | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/ambari-common/src/main/python/ambari_commons/shell.py
b/ambari-common/src/main/python/ambari_commons/shell.py
index 8b28255eab..883a44dc88 100644
--- a/ambari-common/src/main/python/ambari_commons/shell.py
+++ b/ambari-common/src/main/python/ambari_commons/shell.py
@@ -812,8 +812,8 @@ class shellRunnerLinux(shellRunner):
try:
if self._threadLocal is not None:
os.setuid(self._threadLocal.uid)
- except Exception:
- _logger.warn("can not switch user for running command.")
+ except Exception as e:
+ _logger.warn(f"Unable to switch user for running command. Error details:
{e}")
# Run any command
def run(self, script, user=None):
@@ -825,8 +825,9 @@ class shellRunnerLinux(shellRunner):
else:
user = os.getuid()
self._threadLocal.uid = user
- except Exception:
- _logger.warn("can not switch user for RUN_COMMAND.")
+ except Exception as e:
+ _logger.warn(f"Unable to switch user for RUN_COMMAND. Error details:
{e}")
+
cmd = script
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]