Browse Source

AMBARI-14289. Rebalance HDFS fails with Operation not permitted error on an HA cluster (aonishuk)

Andrew Onishuk 9 years ago
parent
commit
b5b8768264

+ 5 - 3
ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py

@@ -26,7 +26,7 @@ from datetime import datetime
 import ambari_simplejson as json # simplejson is much faster comparing to Python 2.6 json module and has the same functions set.
 
 from resource_management import Script
-from resource_management.core.resources.system import Execute
+from resource_management.core.resources.system import Execute, File
 from resource_management.core import shell
 from resource_management.libraries.functions import conf_select
 from resource_management.libraries.functions import hdp_select
@@ -369,9 +369,11 @@ class NameNodeDefault(NameNode):
             logoutput = False,
     )
 
-    if params.security_enabled and os.path.exists(ccache_file_path):
+    if params.security_enabled:
       # Delete the kerberos credentials cache (ccache) file
-      os.remove(ccache_file_path)
+      File(ccache_file_path,
+           action = "delete",
+      )
 
 @OsFamilyImpl(os_family=OSConst.WINSRV_FAMILY)
 class NameNodeWindows(NameNode):

+ 3 - 0
ambari-server/src/test/python/stacks/2.0.6/HDFS/test_namenode.py

@@ -1231,6 +1231,9 @@ class TestNamenode(RMFTestCase):
                               logoutput = False,
                               on_new_line = FunctionMock('handle_new_line'),
                               )
+    self.assertResourceCalled('File', ccache_path,
+                              action = ['delete'],
+                              )
     self.assertNoMoreResources()
 
   @patch("os.path.isfile")