ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject [35/50] [abbrv] ambari git commit: AMBARI-13935. Kafka can not to start with custom lo/pid dirs with changed permissions after ambari-server reset (aonishuk)
Date Wed, 18 Nov 2015 16:51:31 GMT
AMBARI-13935. Kafka can not to start with custom lo/pid dirs with changed permissions after
ambari-server reset (aonishuk)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 6db7de9f3a10dc97531866fa8e2ce666568d61e4
Parents: e383cf9
Author: Andrew Onishuk <aonishuk@hortonworks.com>
Authored: Wed Nov 18 12:03:30 2015 +0200
Committer: Andrew Onishuk <aonishuk@hortonworks.com>
Committed: Wed Nov 18 12:03:30 2015 +0200

----------------------------------------------------------------------
 .../src/main/python/ambari_agent/HostInfo.py    | 22 +++++++++++++++-----
 .../test/python/ambari_agent/TestHostInfo.py    |  4 ++--
 2 files changed, 19 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6db7de9f/ambari-agent/src/main/python/ambari_agent/HostInfo.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/HostInfo.py b/ambari-agent/src/main/python/ambari_agent/HostInfo.py
index 9460256..982e0d8 100644
--- a/ambari-agent/src/main/python/ambari_agent/HostInfo.py
+++ b/ambari-agent/src/main/python/ambari_agent/HostInfo.py
@@ -149,10 +149,15 @@ class HostInfoLinux(HostInfo):
   ]
   
   # Default set of directories that are checked for existence of files and folders
-  DEFAULT_DIRS = [
+  DEFAULT_BASEDIRS = [
     "/etc", "/var/run", "/var/log", "/usr/lib", "/var/lib", "/var/tmp", "/tmp", "/var",
     "/hadoop", "/usr/hdp"
   ]
+  
+  # Exact directories names which are checked for existance
+  EXACT_DIRECTORIES = [
+    "/kafka-logs"
+  ]
 
   DEFAULT_SERVICE_NAME = "ntpd"
   SERVICE_STATUS_CMD = "%s %s status" % (SERVICE_CMD, DEFAULT_SERVICE_NAME)
@@ -174,7 +179,7 @@ class HostInfoLinux(HostInfo):
         result['status'] = "Available"
         results.append(result)
 
-  def checkFolders(self, basePaths, projectNames, existingUsers, dirs):
+  def checkFolders(self, basePaths, projectNames, exactDirectories, existingUsers, dirs):
     foldersToIgnore = []
     for user in existingUsers:
       foldersToIgnore.append(user['homeDir'])
@@ -187,8 +192,15 @@ class HostInfoLinux(HostInfo):
             obj['type'] = self.dirType(path)
             obj['name'] = path
             dirs.append(obj)
+            
+      for path in exactDirectories:
+        if os.path.exists(path):
+          obj = {}
+          obj['type'] = self.dirType(path)
+          obj['name'] = path
+          dirs.append(obj)     
     except:
-      pass
+      logger.exception("Checking folders failed")
 
   def javaProcs(self, list):
     import pwd
@@ -213,7 +225,7 @@ class HostInfoLinux(HostInfo):
                 dict['user'] = pwd.getpwuid(uid).pw_name
             list.append(dict)
     except:
-      pass
+      logger.exception("Checking java processes failed")
     pass
 
   def getTransparentHugePage(self):
@@ -296,7 +308,7 @@ class HostInfoLinux(HostInfo):
       dict['existingUsers'] = existingUsers
 
       dirs = []
-      self.checkFolders(self.DEFAULT_DIRS, self.DEFAULT_PROJECT_NAMES, existingUsers, dirs)
+      self.checkFolders(self.DEFAULT_BASEDIRS, self.DEFAULT_PROJECT_NAMES, self.EXACT_DIRECTORIES,
existingUsers, dirs)
       dict['stackFoldersAndFiles'] = dirs
 
       self.reportFileHandler.writeHostCheckFile(dict)

http://git-wip-us.apache.org/repos/asf/ambari/blob/6db7de9f/ambari-agent/src/test/python/ambari_agent/TestHostInfo.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestHostInfo.py b/ambari-agent/src/test/python/ambari_agent/TestHostInfo.py
index 4a1f5f4..71ee23f 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestHostInfo.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestHostInfo.py
@@ -198,9 +198,9 @@ class TestHostInfo(TestCase):
     hostInfo = HostInfo()
     results = []
     existingUsers = [{'name':'a1', 'homeDir':os.path.join('home', 'a1')}, {'name':'b1', 'homeDir':os.path.join('home',
'b1')}]
-    hostInfo.checkFolders([os.path.join("etc", "conf"), os.path.join("var", "lib"), "home"],
["a1", "b1"], existingUsers, results)
+    hostInfo.checkFolders([os.path.join("etc", "conf"), os.path.join("var", "lib"), "home"],
["a1", "b1"], ["c","d"], existingUsers, results)
     print results
-    self.assertEqual(4, len(results))
+    self.assertEqual(6, len(results))
     names = [i['name'] for i in results]
     for item in [os.path.join('etc','conf','a1'), os.path.join('var','lib','a1'), os.path.join('etc','conf','b1'),
os.path.join('var','lib','b1')]:
 


Mime
View raw message