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 2015/11/18 11:03:46 UTC
[1/2] ambari git commit: AMBARI-13935. Kafka can not to start with
custom lo/pid dirs with changed permissions after ambari-server reset
(aonishuk)
Repository: ambari
Updated Branches:
refs/heads/branch-2.1 f5283f730 -> c6ce84756
refs/heads/trunk e383cf9f9 -> 6db7de9f3
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/trunk
Commit: 6db7de9f3a10dc97531866fa8e2ce666568d61e4
Parents: e383cf9
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Wed Nov 18 12:03:30 2015 +0200
Committer: Andrew Onishuk <ao...@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')]:
[2/2] ambari git commit: AMBARI-13935. Kafka can not to start with
custom lo/pid dirs with changed permissions after ambari-server reset
(aonishuk)
Posted by ao...@apache.org.
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/c6ce8475
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c6ce8475
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c6ce8475
Branch: refs/heads/branch-2.1
Commit: c6ce84756a73cb8be4335b3658e067790d79ec32
Parents: f5283f7
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Wed Nov 18 12:03:33 2015 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Wed Nov 18 12:03:33 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/c6ce8475/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 4082ebe..5feaf6c 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/c6ce8475/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 9a9dcb2..fd50b05 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')]: