ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject ambari git commit: AMBARI-18499 Ability to remove broken symbolic links via HostCleanup.py (dili)
Date Mon, 03 Oct 2016 15:45:22 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 30eadbf07 -> 7b15e388c


AMBARI-18499 Ability to remove broken symbolic links via HostCleanup.py (dili)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7b15e388
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7b15e388
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7b15e388

Branch: refs/heads/trunk
Commit: 7b15e388c37cd2cabf224568760ab127d07412ca
Parents: 30eadbf
Author: Di Li <dili@apache.org>
Authored: Mon Oct 3 11:44:52 2016 -0400
Committer: Di Li <dili@apache.org>
Committed: Mon Oct 3 11:44:52 2016 -0400

----------------------------------------------------------------------
 ambari-agent/src/main/python/ambari_agent/HostCleanup.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7b15e388/ambari-agent/src/main/python/ambari_agent/HostCleanup.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/HostCleanup.py b/ambari-agent/src/main/python/ambari_agent/HostCleanup.py
index e9ae8e5..a3c72e6 100644
--- a/ambari-agent/src/main/python/ambari_agent/HostCleanup.py
+++ b/ambari-agent/src/main/python/ambari_agent/HostCleanup.py
@@ -405,13 +405,13 @@ class HostCleanup:
   def do_erase_files_silent(self, pathList):
     if pathList:
       for path in pathList:
-        if path and os.path.exists(path):
+        if path and ( os.path.exists(path) or os.path.islink(path) ):
           try:
             os.remove(path)
           except:
-            logger.warn("Failed to delete file: " + path + ", error: " + str(sys.exc_info()[0]))
+            logger.warn("Failed to delete file: {0}, error: {1}".format(path, str(sys.exc_info()[0])))
         else:
-          logger.info("File doesn't exists: " + path)
+          logger.info("File doesn't exists: {0}".format(path))
     return 0
 
   def do_delete_group(self):


Mime
View raw message