|
@@ -147,6 +147,33 @@ class HostInfoLinux(HostInfo):
|
|
"/hadoop", "/usr/hdp"
|
|
"/hadoop", "/usr/hdp"
|
|
]
|
|
]
|
|
|
|
|
|
|
|
+ # Packages that are used to find repos (then repos are used to find other packages)
|
|
|
|
+ PACKAGES = [
|
|
|
|
+ "hadoop_2_2_*", "hadoop-2-2-.*", "zookeeper_2_2_*", "zookeeper-2-2-.*",
|
|
|
|
+ "hadoop", "zookeeper", "webhcat", "*-manager-server-db", "*-manager-daemons"
|
|
|
|
+ ]
|
|
|
|
+
|
|
|
|
+ # Additional packages to look for (search packages that start with these)
|
|
|
|
+ ADDITIONAL_PACKAGES = [
|
|
|
|
+ "rrdtool", "rrdtool-python", "ganglia", "gmond", "gweb", "libconfuse",
|
|
|
|
+ "ambari-log4j", "hadoop", "zookeeper", "oozie", "webhcat"
|
|
|
|
+ ]
|
|
|
|
+
|
|
|
|
+ # ignore packages from repos whose names start with these strings
|
|
|
|
+ IGNORE_PACKAGES_FROM_REPOS = [
|
|
|
|
+ "ambari", "installed"
|
|
|
|
+ ]
|
|
|
|
+
|
|
|
|
+ # ignore required packages
|
|
|
|
+ IGNORE_PACKAGES = [
|
|
|
|
+ "epel-release"
|
|
|
|
+ ]
|
|
|
|
+
|
|
|
|
+ # ignore repos from the list of repos to be cleaned
|
|
|
|
+ IGNORE_REPOS = [
|
|
|
|
+ "ambari", "HDP-UTILS"
|
|
|
|
+ ]
|
|
|
|
+
|
|
DEFAULT_SERVICE_NAME = "ntpd"
|
|
DEFAULT_SERVICE_NAME = "ntpd"
|
|
SERVICE_STATUS_CMD = "%s %s status" % (SERVICE_CMD, DEFAULT_SERVICE_NAME)
|
|
SERVICE_STATUS_CMD = "%s %s status" % (SERVICE_CMD, DEFAULT_SERVICE_NAME)
|
|
|
|
|
|
@@ -175,6 +202,8 @@ class HostInfoLinux(HostInfo):
|
|
result['name'] = fields[0]
|
|
result['name'] = fields[0]
|
|
result['homeDir'] = fields[5]
|
|
result['homeDir'] = fields[5]
|
|
result['status'] = "Available"
|
|
result['status'] = "Available"
|
|
|
|
+ if not os.path.exists(homeDir):
|
|
|
|
+ result['status'] = "Invalid home directory"
|
|
results.append(result)
|
|
results.append(result)
|
|
|
|
|
|
def checkFolders(self, basePaths, projectNames, existingUsers, dirs):
|
|
def checkFolders(self, basePaths, projectNames, existingUsers, dirs):
|
|
@@ -219,6 +248,18 @@ class HostInfoLinux(HostInfo):
|
|
pass
|
|
pass
|
|
pass
|
|
pass
|
|
|
|
|
|
|
|
+ def getReposToRemove(self, repos, ignoreList):
|
|
|
|
+ reposToRemove = []
|
|
|
|
+ for repo in repos:
|
|
|
|
+ addToRemoveList = True
|
|
|
|
+ for ignoreRepo in ignoreList:
|
|
|
|
+ if packages_analyzer.nameMatch(ignoreRepo, repo):
|
|
|
|
+ addToRemoveList = False
|
|
|
|
+ continue
|
|
|
|
+ if addToRemoveList:
|
|
|
|
+ reposToRemove.append(repo)
|
|
|
|
+ return reposToRemove
|
|
|
|
+
|
|
def getTransparentHugePage(self):
|
|
def getTransparentHugePage(self):
|
|
# This file exist only on redhat 6
|
|
# This file exist only on redhat 6
|
|
thp_regex = "\[(.+)\]"
|
|
thp_regex = "\[(.+)\]"
|
|
@@ -282,6 +323,8 @@ class HostInfoLinux(HostInfo):
|
|
# If commands are in progress or components are already mapped to this host
|
|
# If commands are in progress or components are already mapped to this host
|
|
# Then do not perform certain expensive host checks
|
|
# Then do not perform certain expensive host checks
|
|
if componentsMapped or commandsInProgress:
|
|
if componentsMapped or commandsInProgress:
|
|
|
|
+ dict['existingRepos'] = [self.RESULT_UNAVAILABLE]
|
|
|
|
+ dict['installedPackages'] = []
|
|
dict['alternatives'] = []
|
|
dict['alternatives'] = []
|
|
dict['stackFoldersAndFiles'] = []
|
|
dict['stackFoldersAndFiles'] = []
|
|
dict['existingUsers'] = []
|
|
dict['existingUsers'] = []
|
|
@@ -299,6 +342,23 @@ class HostInfoLinux(HostInfo):
|
|
self.checkFolders(self.DEFAULT_DIRS, self.DEFAULT_PROJECT_NAMES, existingUsers, dirs)
|
|
self.checkFolders(self.DEFAULT_DIRS, self.DEFAULT_PROJECT_NAMES, existingUsers, dirs)
|
|
dict['stackFoldersAndFiles'] = dirs
|
|
dict['stackFoldersAndFiles'] = dirs
|
|
|
|
|
|
|
|
+ installedPackages = []
|
|
|
|
+ availablePackages = []
|
|
|
|
+ packages_analyzer.allInstalledPackages(installedPackages)
|
|
|
|
+ packages_analyzer.allAvailablePackages(availablePackages)
|
|
|
|
+
|
|
|
|
+ repos = []
|
|
|
|
+ packages_analyzer.getInstalledRepos(self.PACKAGES, installedPackages + availablePackages,
|
|
|
|
+ self.IGNORE_PACKAGES_FROM_REPOS, repos)
|
|
|
|
+ packagesInstalled = packages_analyzer.getInstalledPkgsByRepo(repos, self.IGNORE_PACKAGES, installedPackages)
|
|
|
|
+ additionalPkgsInstalled = packages_analyzer.getInstalledPkgsByNames(
|
|
|
|
+ self.ADDITIONAL_PACKAGES, installedPackages)
|
|
|
|
+ allPackages = list(set(packagesInstalled + additionalPkgsInstalled))
|
|
|
|
+ dict['installedPackages'] = packages_analyzer.getPackageDetails(installedPackages, allPackages)
|
|
|
|
+
|
|
|
|
+ repos = self.getReposToRemove(repos, self.IGNORE_REPOS)
|
|
|
|
+ dict['existingRepos'] = repos
|
|
|
|
+
|
|
self.reportFileHandler.writeHostCheckFile(dict)
|
|
self.reportFileHandler.writeHostCheckFile(dict)
|
|
pass
|
|
pass
|
|
|
|
|
|
@@ -409,6 +469,8 @@ class HostInfoWindows(HostInfo):
|
|
# If commands are in progress or components are already mapped to this host
|
|
# If commands are in progress or components are already mapped to this host
|
|
# Then do not perform certain expensive host checks
|
|
# Then do not perform certain expensive host checks
|
|
if componentsMapped or commandsInProgress:
|
|
if componentsMapped or commandsInProgress:
|
|
|
|
+ dict['existingRepos'] = [self.RESULT_UNAVAILABLE]
|
|
|
|
+ dict['installedPackages'] = []
|
|
dict['alternatives'] = []
|
|
dict['alternatives'] = []
|
|
dict['stackFoldersAndFiles'] = []
|
|
dict['stackFoldersAndFiles'] = []
|
|
dict['existingUsers'] = []
|
|
dict['existingUsers'] = []
|