You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ds...@apache.org on 2014/04/04 21:39:48 UTC

git commit: AMBARI-5354 Automatic Bootstrap on cento5 fails when no python2.6 is present (anishuk via dsen)

Repository: ambari
Updated Branches:
  refs/heads/trunk e63a05a85 -> c21459200


AMBARI-5354 Automatic Bootstrap on cento5 fails when no python2.6 is present (anishuk via dsen)


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

Branch: refs/heads/trunk
Commit: c21459200eb16efdff5a253d31bc7375791b4042
Parents: e63a05a
Author: Dmitry Sen <ds...@hortonworks.com>
Authored: Fri Apr 4 22:39:42 2014 +0300
Committer: Dmitry Sen <ds...@hortonworks.com>
Committed: Fri Apr 4 22:39:42 2014 +0300

----------------------------------------------------------------------
 .../src/main/python/common_functions/os_check.py | 19 +++++++++++++++----
 ambari-server/src/main/python/os_check_type.py   |  2 +-
 2 files changed, 16 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c2145920/ambari-common/src/main/python/common_functions/os_check.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/common_functions/os_check.py b/ambari-common/src/main/python/common_functions/os_check.py
index 982d1d0..1256a07 100644
--- a/ambari-common/src/main/python/common_functions/os_check.py
+++ b/ambari-common/src/main/python/common_functions/os_check.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2.6
+#!/usr/bin/env python
 
 '''
 Licensed to the Apache Software Foundation (ASF) under one
@@ -19,9 +19,20 @@ limitations under the License.
 '''
 
 import os
+import sys
 import platform
 
 
+def linux_distribution():
+  PYTHON_VER = sys.version_info[0] * 10 + sys.version_info[1]
+
+  if PYTHON_VER < 26:
+    linux_distribution = platform.dist()
+  else:
+    linux_distribution = platform.linux_distribution()
+
+  return linux_distribution
+
 class OSCheck:
 
   @staticmethod
@@ -36,7 +47,7 @@ class OSCheck:
     """
     # Read content from /etc/*-release file
     # Full release name
-    dist = platform.linux_distribution()
+    dist = linux_distribution()
     operatingSystem = dist[0].lower()
 
     # special cases
@@ -81,7 +92,7 @@ class OSCheck:
     """
     # Read content from /etc/*-release file
     # Full release name
-    dist = platform.linux_distribution()
+    dist = linux_distribution()
     dist = dist[1]
 
     if dist:
@@ -105,7 +116,7 @@ class OSCheck:
 
     In case cannot detect raises exception.
     """
-    dist = platform.linux_distribution()
+    dist = linux_distribution()
     dist = dist[2].lower()
 
     if dist:

http://git-wip-us.apache.org/repos/asf/ambari/blob/c2145920/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 ce3d9da..f1823e3 100644
--- a/ambari-server/src/main/python/os_check_type.py
+++ b/ambari-server/src/main/python/os_check_type.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2.6
+#!/usr/bin/env python
 
 '''
 Licensed to the Apache Software Foundation (ASF) under one