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-19715: HostCleanup remove ambari.repo when ambari.repo has repo ID that doesn't begin with word AMBARI (dili)
Date Thu, 26 Jan 2017 15:59:26 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 8d390fa18 -> 9bc765ab0


AMBARI-19715: HostCleanup remove ambari.repo when ambari.repo has repo ID that doesn't begin
with word AMBARI (dili)


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

Branch: refs/heads/trunk
Commit: 9bc765ab016d3cd0a2253ab6e28c9e27a6c77418
Parents: 8d390fa
Author: Di Li <dili@apache.org>
Authored: Thu Jan 26 10:59:15 2017 -0500
Committer: Di Li <dili@apache.org>
Committed: Thu Jan 26 10:59:15 2017 -0500

----------------------------------------------------------------------
 .../resource_management/TestPackagesAnalyzer.py | 46 ++++++++++++++++++++
 .../libraries/functions/packages_analyzer.py    |  2 +-
 2 files changed, 47 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9bc765ab/ambari-agent/src/test/python/resource_management/TestPackagesAnalyzer.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/resource_management/TestPackagesAnalyzer.py b/ambari-agent/src/test/python/resource_management/TestPackagesAnalyzer.py
index f898919..e02e442 100644
--- a/ambari-agent/src/test/python/resource_management/TestPackagesAnalyzer.py
+++ b/ambari-agent/src/test/python/resource_management/TestPackagesAnalyzer.py
@@ -138,4 +138,50 @@ class TestPackagesAnalyzer(TestCase):
     self.assertEqual(7, len(allPackages))
     expected = ["hadoop-a", "zk", "webhcat", "hadoop-b", "ganglia", "rrd", "def-def.x86"]
     for package in expected:
+      self.assertTrue(package in allPackages)
+
+  def test_perform_package_analysis_custom_reponame(self):
+    installedPackages = [
+      ["hadoop-a", "2.3", "HDP"], ["zk", "3.1", "HDP"], ["webhcat", "3.1", "HDP"],
+      ["hadoop-b", "2.3", "HDP-epel"], ["epel", "3.1", "HDP-epel"], ["epel-2", "3.1", "HDP-epel"],
+      ["hadoop-c", "2.3", "GITHUB_Ambari"], ["ambari-s", "3.1", "GITHUB_Ambari"],
+      ["ganglia", "2.3", "GANGLIA"], ["rrd", "3.1", "RRD"],
+      ["keeper-1", "2.3", "GANGLIA"], ["keeper-2", "3.1", "base"],["def-def.x86", "2.2",
"DEF.3"],
+      ["def.1", "1.2", "NewDEF"]
+    ]
+    availablePackages = [
+      ["hadoop-d", "2.3", "HDP"], ["zk-2", "3.1", "HDP"], ["pig", "3.1", "HDP"],
+      ["epel-3", "2.3", "HDP-epel"], ["hadoop-e", "3.1", "HDP-epel"],
+      ["ambari-a", "3.1", "GITHUB_Ambari"],
+      ["keeper-3", "3.1", "base"]
+    ]
+
+    packagesToLook = ["^webhcat.*$", "^hadoop.*$", "^.+-def.*$"]
+    reposToIgnore = ["ambari"]
+    additionalPackages = ["ganglia", "rrd"]
+
+    repos = []
+    packages_analyzer.getInstalledRepos(packagesToLook, installedPackages + availablePackages,
reposToIgnore, repos)
+    self.assertEqual(3, len(repos))
+    expected = ["HDP", "HDP-epel", "DEF.3"]
+    for repo in expected:
+      self.assertTrue(repo in repos)
+
+    packagesInstalled = packages_analyzer.getInstalledPkgsByRepo(repos, ["epel"], installedPackages)
+    self.assertEqual(5, len(packagesInstalled))
+    expected = ["hadoop-a", "zk", "webhcat", "hadoop-b", "def-def.x86"]
+    for repo in expected:
+      self.assertTrue(repo in packagesInstalled)
+
+    additionalPkgsInstalled = packages_analyzer.getInstalledPkgsByNames(
+      additionalPackages, installedPackages)
+    self.assertEqual(2, len(additionalPkgsInstalled))
+    expected = ["ganglia", "rrd"]
+    for additionalPkg in expected:
+      self.assertTrue(additionalPkg in additionalPkgsInstalled)
+
+    allPackages = list(set(packagesInstalled + additionalPkgsInstalled))
+    self.assertEqual(7, len(allPackages))
+    expected = ["hadoop-a", "zk", "webhcat", "hadoop-b", "ganglia", "rrd", "def-def.x86"]
+    for package in expected:
       self.assertTrue(package in allPackages)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/9bc765ab/ambari-common/src/main/python/resource_management/libraries/functions/packages_analyzer.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/packages_analyzer.py
b/ambari-common/src/main/python/resource_management/libraries/functions/packages_analyzer.py
index 9df2b64..8a15ee5 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/packages_analyzer.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/packages_analyzer.py
@@ -186,7 +186,7 @@ def _lookUpZypperPackages(command, allPackages):
 def nameMatch(lookupName, actualName):
   tokens = actualName.strip().split()
   for token in tokens:
-    if token.lower().find(lookupName.lower()) == 0:
+    if lookupName.lower() in token.lower():
       return True
   return False
 


Mime
View raw message