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 2018/07/05 13:21:00 UTC
[ambari] branch trunk updated: AMBARI-24247. Kafka failed to stop
(aonishuk)
This is an automated email from the ASF dual-hosted git repository.
aonishuk 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 3b0ce61 AMBARI-24247. Kafka failed to stop (aonishuk)
3b0ce61 is described below
commit 3b0ce61f8f1e09b1286aa807280681aa9dc506f3
Author: Andrew Onishuk <ao...@hortonworks.com>
AuthorDate: Thu Jul 5 14:35:40 2018 +0300
AMBARI-24247. Kafka failed to stop (aonishuk)
---
.../src/main/python/resource_management/core/sudo.py | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/ambari-common/src/main/python/resource_management/core/sudo.py b/ambari-common/src/main/python/resource_management/core/sudo.py
index a0a8e45..f103c8d 100644
--- a/ambari-common/src/main/python/resource_management/core/sudo.py
+++ b/ambari-common/src/main/python/resource_management/core/sudo.py
@@ -49,10 +49,16 @@ if os.geteuid() == 0:
for root, dirs, files in unicode_walk(path, followlinks=True):
for name in files + dirs:
- if follow_links:
- os.chown(os.path.join(root, name), uid, gid)
- else:
- os.lchown(os.path.join(root, name), uid, gid)
+ try:
+ if follow_links:
+ os.chown(os.path.join(root, name), uid, gid)
+ else:
+ os.lchown(os.path.join(root, name), uid, gid)
+ except OSError as ex:
+ # Handle race condition: file was deleted/moved while iterating by
+ # ignoring OSError: [Errno 2] No such file or directory
+ if ex.errno != errno.ENOENT:
+ raise
def chmod(path, mode):