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/06 10:13:45 UTC
[ambari] branch branch-2.7 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 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 9c5e9e2 AMBARI-24247. Kafka failed to stop (aonishuk)
9c5e9e2 is described below
commit 9c5e9e26a62a67c3fe5bc311e88c6d4f2242c3d7
Author: Andrew Onishuk <ao...@hortonworks.com>
AuthorDate: Fri Jul 6 12:23:12 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):