This is an automated email from the ASF dual-hosted git repository.

rlevas 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 be7b4d1  [AMBARI-23380] Fix intermittent "No such file or directory" 
error in TestHostCleanup
be7b4d1 is described below

commit be7b4d15549b7cfb5d10a76187045f455fbe893d
Author: Robert Levas <[email protected]>
AuthorDate: Tue Mar 27 13:45:55 2018 -0400

    [AMBARI-23380] Fix intermittent "No such file or directory" error in 
TestHostCleanup
---
 ambari-agent/src/main/python/ambari_agent/HostCleanup.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/ambari-agent/src/main/python/ambari_agent/HostCleanup.py 
b/ambari-agent/src/main/python/ambari_agent/HostCleanup.py
index 7e53305..c6f5bff 100644
--- a/ambari-agent/src/main/python/ambari_agent/HostCleanup.py
+++ b/ambari-agent/src/main/python/ambari_agent/HostCleanup.py
@@ -511,8 +511,13 @@ class HostCleanup:
     for folder in folders:
       for filename in os.listdir(folder):
         fileToCheck = os.path.join(folder, filename)
-        stat = os.stat(fileToCheck)
-        if stat.st_uid in userIds:
+        try:
+          stat = os.stat(fileToCheck)
+        except OSError:
+          stat = None
+          logger.warn("Cannot stat file, skipping: " + fileToCheck)
+
+        if stat and stat.st_uid in userIds:
           self.do_erase_dir_silent([fileToCheck])
           logger.info("Deleting file/folder: " + fileToCheck)
 

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to