ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jonathanhur...@apache.org
Subject ambari git commit: AMBARI-22076 - Use A Scoped Repo When Installing stack-tools (jonathanhurley)
Date Wed, 27 Sep 2017 18:06:24 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 40e712a18 -> 4da28dfff


AMBARI-22076 - Use A Scoped Repo When Installing stack-tools (jonathanhurley)


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

Branch: refs/heads/trunk
Commit: 4da28dffffa7b2fe362d52de34ec3f0ec47bfb30
Parents: 40e712a
Author: Jonathan Hurley <jhurley@hortonworks.com>
Authored: Wed Sep 27 11:52:11 2017 -0400
Committer: Jonathan Hurley <jhurley@hortonworks.com>
Committed: Wed Sep 27 14:04:40 2017 -0400

----------------------------------------------------------------------
 .../core/providers/package/yumrpm.py             |  2 +-
 .../custom_actions/scripts/install_packages.py   | 19 ++++++++++++++-----
 .../python/custom_actions/TestInstallPackages.py | 14 +++++++-------
 3 files changed, 22 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4da28dff/ambari-common/src/main/python/resource_management/core/providers/package/yumrpm.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/core/providers/package/yumrpm.py
b/ambari-common/src/main/python/resource_management/core/providers/package/yumrpm.py
index 78c77ca..a4a55da 100644
--- a/ambari-common/src/main/python/resource_management/core/providers/package/yumrpm.py
+++ b/ambari-common/src/main/python/resource_management/core/providers/package/yumrpm.py
@@ -216,7 +216,7 @@ class YumProvider(RPMBasedPackageProvider):
       cmd = INSTALL_CMD[self.get_logoutput()]
       if use_repos:
         enable_repo_option = '--enablerepo=' + ",".join(use_repos)
-        disable_repo_option = '--disablerepo=' + "*,".join(skip_repos)
+        disable_repo_option = '--disablerepo=' + "*" if len(skip_repos) == 0 else ','.join(skip_repos)
         cmd = cmd + [disable_repo_option, enable_repo_option]
       cmd = cmd + [name]
       Logger.info("Installing package %s ('%s')" % (name, string_cmd_from_args_list(cmd)))

http://git-wip-us.apache.org/repos/asf/ambari/blob/4da28dff/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py b/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py
index 6a80a43..dcf3544 100644
--- a/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py
+++ b/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py
@@ -316,19 +316,28 @@ class InstallPackages(Script):
     packages_were_checked = False
     packages_installed_before = []
     stack_selector_package = stack_tools.get_stack_tool_package(stack_tools.STACK_SELECTOR_NAME)
+
     try:
+      # install the stack-selector; we need to supply the action as "upgrade" here since
the normal
+      # install command will skip if the package is already installed in the system.
+      # This is required for non-versioned components, like stack-select, since each version
of
+      # the stack comes with one. Also, scope the install by repository since we need to
pick a
+      # specific repo that the stack-select tools are coming out of in case there are multiple
+      # patches installed
+      repositories = config['repositoryFile']['repositories']
+      repository_ids = [repository['repoId'] for repository in repositories]
       Package(stack_selector_package,
-              action="upgrade",
-              retry_on_repo_unavailability=agent_stack_retry_on_unavailability,
-              retry_count=agent_stack_retry_count
-      )
+        action="upgrade",
+        use_repos=repository_ids,
+        retry_on_repo_unavailability=agent_stack_retry_on_unavailability,
+        retry_count=agent_stack_retry_count)
       
       packages_installed_before = self.pkg_provider.all_installed_packages()
       packages_installed_before = [package[0] for package in packages_installed_before]
       packages_were_checked = True
       filtered_package_list = self.filter_package_list(package_list)
       try:
-        available_packages_in_repos = self.pkg_provider.get_available_packages_in_repos(config['repositoryFile']['repositories'])
+        available_packages_in_repos = self.pkg_provider.get_available_packages_in_repos(repositories)
       except Exception:
         available_packages_in_repos = []
       for package in filtered_package_list:

http://git-wip-us.apache.org/repos/asf/ambari/blob/4da28dff/ambari-server/src/test/python/custom_actions/TestInstallPackages.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/custom_actions/TestInstallPackages.py b/ambari-server/src/test/python/custom_actions/TestInstallPackages.py
index a946fdd..0f303be 100644
--- a/ambari-server/src/test/python/custom_actions/TestInstallPackages.py
+++ b/ambari-server/src/test/python/custom_actions/TestInstallPackages.py
@@ -139,7 +139,7 @@ class TestInstallPackages(RMFTestCase):
                                 mirror_list=None,
                                 append_to_file=True,
       )
-      self.assertResourceCalled('Package', 'hdp-select', action=["upgrade"], retry_count=5,
retry_on_repo_unavailability=False)
+      self.assertResourceCalled('Package', 'hdp-select', action=["upgrade"], use_repos=['HDP-UTILS-1.1.0.20',
'HDP-2.2'], retry_count=5, retry_on_repo_unavailability=False)
       self.assertResourceCalled('Package', 'hadoop_2_2_0_1_885', action=["upgrade"], retry_count=5,
retry_on_repo_unavailability=False)
       self.assertResourceCalled('Package', 'snappy', action=["upgrade"], retry_count=5, retry_on_repo_unavailability=False)
       self.assertResourceCalled('Package', 'snappy-devel', action=["upgrade"], retry_count=5,
retry_on_repo_unavailability=False)
@@ -190,7 +190,7 @@ class TestInstallPackages(RMFTestCase):
                          'repository_version_id': 1,
                          'actual_version': VERSION_STUB})
 
-      self.assertResourceCalled('Package', 'hdp-select', action=["upgrade"], retry_count=5,
retry_on_repo_unavailability=False)
+      self.assertResourceCalled('Package', 'hdp-select', action=["upgrade"], use_repos=[],
retry_count=5, retry_on_repo_unavailability=False)
       self.assertResourceCalled('Package', None, action=["upgrade"], retry_count=5, retry_on_repo_unavailability=False)
       self.assertResourceCalled('Package', 'snappy', action=["upgrade"], retry_count=5, retry_on_repo_unavailability=False)
       self.assertResourceCalled('Package', 'snappy-devel', action=["upgrade"], retry_count=5,
retry_on_repo_unavailability=False)
@@ -254,7 +254,7 @@ class TestInstallPackages(RMFTestCase):
                                 mirror_list=None,
                                 append_to_file=True,
                                 )
-      self.assertResourceCalled('Package', 'hdp-select', action=["upgrade"], retry_count=5,
retry_on_repo_unavailability=False)
+      self.assertResourceCalled('Package', 'hdp-select', action=["upgrade"], use_repos=['HDP-UTILS-1.1.0.20',
'HDP-2.2'], retry_count=5, retry_on_repo_unavailability=False)
       self.assertResourceCalled('Package', 'hadoop_2_2_0_1_885', action=["upgrade"], retry_count=5,
retry_on_repo_unavailability=False)
       self.assertResourceCalled('Package', 'snappy', action=["upgrade"], retry_count=5, retry_on_repo_unavailability=False)
       self.assertResourceCalled('Package', 'snappy-devel', action=["upgrade"], retry_count=5,
retry_on_repo_unavailability=False)
@@ -319,7 +319,7 @@ class TestInstallPackages(RMFTestCase):
                                 mirror_list=None,
                                 append_to_file=True,
       )
-      self.assertResourceCalled('Package', 'hdp-select', action=["upgrade"], retry_count=5,
retry_on_repo_unavailability=False)
+      self.assertResourceCalled('Package', 'hdp-select', action=["upgrade"], use_repos=['HDP-UTILS-1.1.0.20',
'HDP-2.2'], retry_count=5, retry_on_repo_unavailability=False)
       self.assertResourceCalled('Package', 'hadoop_2_2_0_1_885', action=["upgrade"], retry_count=5,
retry_on_repo_unavailability=False)
       self.assertResourceCalled('Package', 'snappy', action=["upgrade"], retry_count=5, retry_on_repo_unavailability=False)
       self.assertResourceCalled('Package', 'snappy-devel', action=["upgrade"], retry_count=5,
retry_on_repo_unavailability=False)
@@ -464,7 +464,7 @@ class TestInstallPackages(RMFTestCase):
                                 mirror_list=None,
                                 append_to_file=True,
                                 )
-      self.assertResourceCalled('Package', 'hdp-select', action=["upgrade"], retry_count=5,
retry_on_repo_unavailability=False)
+      self.assertResourceCalled('Package', 'hdp-select', action=["upgrade"], use_repos=['HDP-UTILS-1.1.0.20',
'HDP-2.2'], retry_count=5, retry_on_repo_unavailability=False)
       self.assertResourceCalled('Package', 'hadoop_2_2_0_1_885', action=["upgrade"], retry_count=5,
retry_on_repo_unavailability=False)
       self.assertResourceCalled('Package', 'snappy', action=["upgrade"], retry_count=5, retry_on_repo_unavailability=False)
       self.assertResourceCalled('Package', 'snappy-devel', action=["upgrade"], retry_count=5,
retry_on_repo_unavailability=False)
@@ -539,7 +539,7 @@ class TestInstallPackages(RMFTestCase):
                                 mirror_list=None,
                                 append_to_file=True,
                                 )
-      self.assertResourceCalled('Package', 'hdp-select', action=["upgrade"], retry_count=5,
retry_on_repo_unavailability=False)
+      self.assertResourceCalled('Package', 'hdp-select', action=["upgrade"], use_repos=['HDP-UTILS-1.1.0.20-repo-4',
'HDP-2.2-repo-4'], retry_count=5, retry_on_repo_unavailability=False)
       self.assertResourceCalled('Package', 'hadoop_2_2_0_1_885', action=["upgrade"], retry_count=5,
                                 retry_on_repo_unavailability=False)
       self.assertResourceCalled('Package', 'snappy', action=["upgrade"], retry_count=5, retry_on_repo_unavailability=False)
@@ -1177,7 +1177,7 @@ class TestInstallPackages(RMFTestCase):
                                 mirror_list=None,
                                 append_to_file=True,
       )
-      self.assertResourceCalled('Package', 'hdp-select', action=["upgrade"], retry_count=5,
retry_on_repo_unavailability=False)
+      self.assertResourceCalled('Package', 'hdp-select', action=["upgrade"], use_repos=['HDP-UTILS-1.1.0.20-repo-4',
'HDP-2.2-repo-4'], retry_count=5, retry_on_repo_unavailability=False)
       self.assertResourceCalled('Package', 'hadoop_2_2_0_1_885', action=["upgrade"], retry_count=5,
                                 retry_on_repo_unavailability=False)
       self.assertResourceCalled('Package', 'snappy', action=["upgrade"], retry_count=5, retry_on_repo_unavailability=False)


Mime
View raw message