Skip to content

Commit 9c2efd9

Browse files
committed
merge 2.7.11.0-python3 branch to main
2 parents 641b187 + 6b0ec37 commit 9c2efd9

File tree

378 files changed

+3822
-19195
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

378 files changed

+3822
-19195
lines changed
Binary file not shown.

ambari-common/src/main/python/ambari_commons/shell.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# !/usr/bin/env python3
2-
1+
#!/usr/bin/env python3
32
"""
43
Licensed to the Apache Software Foundation (ASF) under one
54
or more contributor license agreements. See the NOTICE file
@@ -325,7 +324,7 @@ def chunks_reader(cmd, kill_timer):
325324

326325
if not data_chunk:
327326
break
328-
str_buffer += data_chunk
327+
str_buffer += data_chunk.decode()
329328

330329
if os.linesep in str_buffer:
331330
copy_offset = str_buffer.rindex(os.linesep)
@@ -812,8 +811,8 @@ def _change_uid(self):
812811
try:
813812
if self._threadLocal is not None:
814813
os.setuid(self._threadLocal.uid)
815-
except Exception:
816-
_logger.warn("can not switch user for running command.")
814+
except Exception as e:
815+
_logger.warn(f"Unable to switch user for running command. Error details: {e}")
817816

818817
# Run any command
819818
def run(self, script, user=None):
@@ -825,8 +824,9 @@ def run(self, script, user=None):
825824
else:
826825
user = os.getuid()
827826
self._threadLocal.uid = user
828-
except Exception:
829-
_logger.warn("can not switch user for RUN_COMMAND.")
827+
except Exception as e:
828+
_logger.warn(f"Unable to switch user for RUN_COMMAND. Error details: {e}")
829+
830830

831831
cmd = script
832832

0 commit comments

Comments
 (0)