Repository: ambari Updated Branches: refs/heads/trunk 869702d10 -> 2cfc2f843
AMBARI-8656 Confirm hosts doesn't passing on CentOS5 (dsen) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2cfc2f84 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2cfc2f84 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2cfc2f84 Branch: refs/heads/trunk Commit: 2cfc2f843d092b8b13f1bd560525a3d0315e59e9 Parents: 869702d Author: Dmytro Sen <d...@apache.org> Authored: Thu Dec 11 16:52:01 2014 +0200 Committer: Dmytro Sen <d...@apache.org> Committed: Thu Dec 11 16:52:01 2014 +0200 ---------------------------------------------------------------------- .../src/main/python/ambari_commons/os_check.py | 39 +++++++++++--------- 1 file changed, 21 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/2cfc2f84/ambari-common/src/main/python/ambari_commons/os_check.py ---------------------------------------------------------------------- diff --git a/ambari-common/src/main/python/ambari_commons/os_check.py b/ambari-common/src/main/python/ambari_commons/os_check.py index f9f1a0e..503f933 100644 --- a/ambari-common/src/main/python/ambari_commons/os_check.py +++ b/ambari-common/src/main/python/ambari_commons/os_check.py @@ -21,30 +21,27 @@ limitations under the License. import os import sys import platform -import ctypes - -class _OSVERSIONINFOEXW(ctypes.Structure): - _fields_ = [('dwOSVersionInfoSize', ctypes.c_ulong), - ('dwMajorVersion', ctypes.c_ulong), - ('dwMinorVersion', ctypes.c_ulong), - ('dwBuildNumber', ctypes.c_ulong), - ('dwPlatformId', ctypes.c_ulong), - ('szCSDVersion', ctypes.c_wchar*128), - ('wServicePackMajor', ctypes.c_ushort), - ('wServicePackMinor', ctypes.c_ushort), - ('wSuiteMask', ctypes.c_ushort), - ('wProductType', ctypes.c_byte), - ('wReserved', ctypes.c_byte)] - -VER_NT_WORKSTATION = 1 -VER_NT_DOMAIN_CONTROLLER = 2 -VER_NT_SERVER = 3 def _get_windows_version(): """ Get's the OS major and minor versions. Returns a tuple of (OS_MAJOR, OS_MINOR). """ + import ctypes + + class _OSVERSIONINFOEXW(ctypes.Structure): + _fields_ = [('dwOSVersionInfoSize', ctypes.c_ulong), + ('dwMajorVersion', ctypes.c_ulong), + ('dwMinorVersion', ctypes.c_ulong), + ('dwBuildNumber', ctypes.c_ulong), + ('dwPlatformId', ctypes.c_ulong), + ('szCSDVersion', ctypes.c_wchar*128), + ('wServicePackMajor', ctypes.c_ushort), + ('wServicePackMinor', ctypes.c_ushort), + ('wSuiteMask', ctypes.c_ushort), + ('wProductType', ctypes.c_byte), + ('wReserved', ctypes.c_byte)] + os_version = _OSVERSIONINFOEXW() os_version.dwOSVersionInfoSize = ctypes.sizeof(os_version) retcode = ctypes.windll.Ntdll.RtlGetVersion(ctypes.byref(os_version)) @@ -68,6 +65,12 @@ REL_2008R2 = "win2008serverr2" REL_2012 = "win2012server" REL_2012R2 = "win2012serverr2" +# windows machine types +VER_NT_WORKSTATION = 1 +VER_NT_DOMAIN_CONTROLLER = 2 +VER_NT_SERVER = 3 + + def os_distribution(): if platform.system() == SYSTEM_WINDOWS: # windows distribution