You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by am...@apache.org on 2018/04/11 09:29:19 UTC

[ambari] branch trunk updated: [AMBARI-23531]. Debian9: Atlas client installation failed due to unsupported OS family error (amagyar) (#959)

This is an automated email from the ASF dual-hosted git repository.

amagyar pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 5db1048  [AMBARI-23531]. Debian9: Atlas client installation failed due to unsupported OS family error (amagyar) (#959)
5db1048 is described below

commit 5db10483fa282d63e30c1acd2fc3af59bc635fda
Author: Attila Magyar <m....@gmail.com>
AuthorDate: Wed Apr 11 11:29:16 2018 +0200

    [AMBARI-23531]. Debian9: Atlas client installation failed due to unsupported OS family error (amagyar) (#959)
    
    * AMBARI-23531. Debian9: Atlas client installation failed due to unsupported OS family error (amagyar)
    
    * Debian9: Atlas client installation failed due to unsupported OS family error (amagyar)
---
 .../python/ambari_commons/repo_manager/__init__.py     | 18 +++++++++---------
 .../test/python/custom_actions/TestInstallPackages.py  |  7 +++++++
 2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/ambari-common/src/main/python/ambari_commons/repo_manager/__init__.py b/ambari-common/src/main/python/ambari_commons/repo_manager/__init__.py
index 7b741a2..f3a5404 100644
--- a/ambari-common/src/main/python/ambari_commons/repo_manager/__init__.py
+++ b/ambari-common/src/main/python/ambari_commons/repo_manager/__init__.py
@@ -59,13 +59,13 @@ class ManagerFactory(object):
     if not os_family:
       os_family = OSCheck.get_os_family()
 
-    construct_rules = {
-      OSConst.UBUNTU_FAMILY: AptManager,
-      OSConst.SUSE_FAMILY: ZypperManager,
-      OSConst.REDHAT_FAMILY: YumManager,
-      OSConst.WINSRV_FAMILY: ChocoManager
-    }
-    if os_family in construct_rules:
-      return construct_rules[os_family]()
+    if OSCheck.is_in_family(os_family, OSConst.UBUNTU_FAMILY):
+      return AptManager()
+    if OSCheck.is_in_family(os_family, OSConst.SUSE_FAMILY):
+      return ZypperManager()
+    if OSCheck.is_in_family(os_family, OSConst.REDHAT_FAMILY):
+      return YumManager()
+    if OSCheck.is_in_family(os_family, OSConst.WINSRV_FAMILY):
+      return ChocoManager()
 
-    raise RuntimeError("Not able to create Repository Manager object for unsupported OS family {0}".format(os_family))
+    raise RuntimeError("Not able to create Repository Manager object for unsupported OS family {0}".format(os_family))
\ No newline at end of file
diff --git a/ambari-server/src/test/python/custom_actions/TestInstallPackages.py b/ambari-server/src/test/python/custom_actions/TestInstallPackages.py
index 9c8306d..7efe226 100644
--- a/ambari-server/src/test/python/custom_actions/TestInstallPackages.py
+++ b/ambari-server/src/test/python/custom_actions/TestInstallPackages.py
@@ -1276,3 +1276,10 @@ class TestInstallPackages(RMFTestCase):
       )
 
       self.assertNoMoreResources()
+
+  def test_os_family_check_with_inheritance(self):
+    from ambari_commons.os_check import OSConst
+    from ambari_commons.repo_manager import ManagerFactory
+    self.assertEquals(
+      ManagerFactory.get_new_instance(OSConst.DEBIAN_FAMILY).__class__,
+      ManagerFactory.get_new_instance(OSConst.UBUNTU_FAMILY).__class__)
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
amagyar@apache.org.