ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From swa...@apache.org
Subject git commit: AMBARI-5413. OS type check for centos 6.5 can fail if the /etc/issue has CentOS Linux release 6.5.
Date Wed, 09 Apr 2014 18:24:42 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 8a79d247e -> 7fd838d1a


AMBARI-5413. OS type check for centos 6.5 can fail if the /etc/issue has CentOS Linux release
6.5.


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

Branch: refs/heads/trunk
Commit: 7fd838d1ad4eab6ad61a94e737a691be39678ad4
Parents: 8a79d24
Author: Siddharth Wagle <swagle@hortonworks.com>
Authored: Wed Apr 9 11:22:02 2014 -0700
Committer: Siddharth Wagle <swagle@hortonworks.com>
Committed: Wed Apr 9 11:22:49 2014 -0700

----------------------------------------------------------------------
 .../src/main/python/ambari_agent/Facter.py      |  2 +-
 .../test/python/ambari_agent/TestHardware.py    | 25 ++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7fd838d1/ambari-agent/src/main/python/ambari_agent/Facter.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/Facter.py b/ambari-agent/src/main/python/ambari_agent/Facter.py
index f9bca94..1d16604 100644
--- a/ambari-agent/src/main/python/ambari_agent/Facter.py
+++ b/ambari-agent/src/main/python/ambari_agent/Facter.py
@@ -111,7 +111,7 @@ class Facter():
 
   # Returns the full name of the OS
   def getOperatingSystem(self):
-    return OSCheck.get_os_type()
+    return OSCheck.get_os_family()
 
   # Returns the OS version
   def getOperatingSystemRelease(self):

http://git-wip-us.apache.org/repos/asf/ambari/blob/7fd838d1/ambari-agent/src/test/python/ambari_agent/TestHardware.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestHardware.py b/ambari-agent/src/test/python/ambari_agent/TestHardware.py
index 0675f67..64d0d12 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestHardware.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestHardware.py
@@ -183,6 +183,31 @@ lo        Link encap:Local Loopback
     self.assertEquals(result['netmask'], '255.255.255.0')
     self.assertEquals(result['interfaces'], 'eth0,eth1,lo')
 
+
+  @patch.object(OSCheck, "get_os_type")
+  @patch.object(OSCheck, "get_os_family")
+  @patch.object(OSCheck, "get_os_version")
+  def test_facterDataOperatingsystemIsFamily(self, get_os_version_mock, get_os_family_mock,
get_os_type_mock):
+    #Check that getOperatingSystem == os_family (NOT os_type)
+    get_os_type_mock.return_value = "some_type_of_os"
+    get_os_version_mock.return_value = "11"
+
+    get_os_family_mock.return_value = "redhat"
+    result = Facter().facterInfo()
+    self.assertEquals(result['operatingsystem'], 'redhat')
+
+    get_os_family_mock.return_value = "debian"
+    result = Facter().facterInfo()
+    self.assertEquals(result['operatingsystem'], 'debian')
+
+    get_os_family_mock.return_value = "suse"
+    result = Facter().facterInfo()
+    self.assertEquals(result['operatingsystem'], 'suse')
+
+    get_os_family_mock.return_value = "My_new_family"
+    result = Facter().facterInfo()
+    self.assertEquals(result['operatingsystem'], 'My_new_family')
+
 if __name__ == "__main__":
   unittest.main()
 


Mime
View raw message