You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2017/11/13 16:58:35 UTC
ambari git commit: AMBARI-22327. Allow different OS types and
versions for Hybrid setup (Yussuf Shaikh via ncole)
Repository: ambari
Updated Branches:
refs/heads/branch-feature-AMBARI-21674 ff8f686f8 -> a11a8712a
AMBARI-22327. Allow different OS types and versions for Hybrid setup (Yussuf Shaikh via ncole)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a11a8712
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a11a8712
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a11a8712
Branch: refs/heads/branch-feature-AMBARI-21674
Commit: a11a8712a7b4702cd765b90767ca4933c089e7b2
Parents: ff8f686
Author: Nate Cole <nc...@hortonworks.com>
Authored: Mon Nov 13 11:58:29 2017 -0500
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Mon Nov 13 11:58:29 2017 -0500
----------------------------------------------------------------------
ambari-server/src/main/python/os_check_type.py | 15 +++++----------
ambari-server/src/test/python/TestOSCheck.py | 13 +++++--------
2 files changed, 10 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/a11a8712/ambari-server/src/main/python/os_check_type.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/os_check_type.py b/ambari-server/src/main/python/os_check_type.py
index 34de34b..da37560 100644
--- a/ambari-server/src/main/python/os_check_type.py
+++ b/ambari-server/src/main/python/os_check_type.py
@@ -28,17 +28,12 @@ def main(argv=None):
raise Exception("Error in number of arguments. Usage: <cluster_os>")
pass
- cluster_os = sys.argv[1]
- current_os = OSCheck.get_os_family() + OSCheck.get_os_major_version()
-
- # If agent/server have the same {"family","main_version"} - then ok.
- print "Cluster primary/cluster OS family is %s and local/current OS family is %s" % (
- cluster_os, current_os)
- if current_os == cluster_os:
- sys.exit(0)
- else:
- raise Exception("Local OS is not compatible with cluster primary OS family. Please perform manual bootstrap on this host.")
+ current_os = get_os_type()
+ #log the current os type value to be used during bootstrap
+ print current_os
+def get_os_type():
+ return OSCheck.get_os_family() + OSCheck.get_os_major_version()
if __name__ == "__main__":
main()
http://git-wip-us.apache.org/repos/asf/ambari/blob/a11a8712/ambari-server/src/test/python/TestOSCheck.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/TestOSCheck.py b/ambari-server/src/test/python/TestOSCheck.py
index 9aba78b..274c424 100644
--- a/ambari-server/src/test/python/TestOSCheck.py
+++ b/ambari-server/src/test/python/TestOSCheck.py
@@ -270,7 +270,7 @@ class TestOSCheck(TestCase):
@patch.object(OSCheck, "os_distribution")
def test_os_type_check(self, mock_linux_distribution):
- # 1 - server and agent os compatible
+ # 1 - should run successfully for agent os
mock_linux_distribution.return_value = ('aaa', '11', 'bb')
base_args = ["os_check_type.py", "aaa11"]
sys.argv = list(base_args)
@@ -281,19 +281,16 @@ class TestOSCheck(TestCase):
# exit_code=0
self.assertEquals("0", str(e))
- # 2 - server and agent os is not compatible
+ # 2 - get_os_type for agent os
mock_linux_distribution.return_value = ('ddd', '33', 'bb')
base_args = ["os_check_type.py", "zzz_x77"]
sys.argv = list(base_args)
try:
- os_check_type.main()
- self.fail("Must fail because os's not compatible.")
+ agent_os_type = os_check_type.get_os_type()
+ self.assertEqual("ddd33", agent_os_type)
except Exception as e:
- self.assertEquals(
- "Local OS is not compatible with cluster primary OS family. Please perform manual bootstrap on this host.",
- str(e))
- pass
+ self.assertEquals("0", str(e))
@patch.object(OSCheck, "get_os_family")
def is_ubuntu_family(self, get_os_family_mock):