Browse Source

AMBARI-5588. Ambari should not hardcode python 2.6, but support 2.6 and higher (aonishuk)

Andrew Onishuk 11 years ago
parent
commit
5e49df1a65
95 changed files with 228 additions and 196 deletions
  1. 6 2
      ambari-agent/conf/unix/ambari-agent
  2. 16 3
      ambari-agent/conf/unix/install-helper.sh
  3. 26 3
      ambari-agent/pom.xml
  4. 3 3
      ambari-agent/src/main/puppet/modules/hdp-yarn/files/validateYarnComponentStatus.py
  5. 6 6
      ambari-agent/src/main/python/ambari_agent/Facter.py
  6. 1 1
      ambari-agent/src/main/python/resource_management/libraries/script/hook.py
  7. 2 2
      ambari-client/pom.xml
  8. 40 0
      ambari-common/src/main/unix/ambari-python-wrap
  9. 15 2
      ambari-server/conf/unix/install-helper.sh
  10. 24 1
      ambari-server/pom.xml
  11. 5 1
      ambari-server/sbin/ambari-server
  12. 1 1
      ambari-server/src/main/python/bootstrap.py
  13. 0 1
      ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/after-INSTALL/scripts/hook.py
  14. 0 1
      ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-INSTALL/scripts/hook.py
  15. 0 2
      ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-RESTART/scripts/hook.py
  16. 0 1
      ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-START/scripts/hook.py
  17. 1 2
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HDFS/package/scripts/hdfs.py
  18. 1 2
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/MAPREDUCE/package/scripts/client.py
  19. 1 2
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/MAPREDUCE/package/scripts/historyserver.py
  20. 2 3
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/MAPREDUCE/package/scripts/jobtracker.py
  21. 0 1
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/MAPREDUCE/package/scripts/mapreduce.py
  22. 0 1
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/MAPREDUCE/package/scripts/params.py
  23. 1 2
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/MAPREDUCE/package/scripts/service.py
  24. 1 3
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/MAPREDUCE/package/scripts/service_check.py
  25. 1 2
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/MAPREDUCE/package/scripts/status_params.py
  26. 1 4
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/MAPREDUCE/package/scripts/tasktracker.py
  27. 1 2
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/PIG/package/scripts/params.py
  28. 5 6
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/PIG/package/scripts/pig.py
  29. 3 4
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/PIG/package/scripts/pig_client.py
  30. 8 9
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/PIG/package/scripts/service_check.py
  31. 1 2
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/WEBHCAT/package/scripts/__init__.py
  32. 1 2
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/WEBHCAT/package/scripts/params.py
  33. 1 2
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/WEBHCAT/package/scripts/service_check.py
  34. 0 1
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/WEBHCAT/package/scripts/webhcat.py
  35. 1 2
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/WEBHCAT/package/scripts/webhcat_server.py
  36. 0 1
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/WEBHCAT/package/scripts/webhcat_service.py
  37. 1 2
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/ZOOKEEPER/package/scripts/__init__.py
  38. 0 1
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/ZOOKEEPER/package/scripts/params.py
  39. 1 2
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/ZOOKEEPER/package/scripts/service_check.py
  40. 0 1
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/ZOOKEEPER/package/scripts/zookeeper.py
  41. 1 2
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/ZOOKEEPER/package/scripts/zookeeper_client.py
  42. 1 2
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/ZOOKEEPER/package/scripts/zookeeper_server.py
  43. 1 2
      ambari-server/src/main/resources/stacks/HDP/1.3.2/services/ZOOKEEPER/package/scripts/zookeeper_service.py
  44. 0 1
      ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-INSTALL/scripts/hook.py
  45. 0 2
      ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-RESTART/scripts/hook.py
  46. 0 1
      ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/hook.py
  47. 1 2
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HDFS/package/scripts/hdfs.py
  48. 1 2
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/PIG/package/scripts/params.py
  49. 3 4
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/PIG/package/scripts/pig.py
  50. 3 4
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/PIG/package/scripts/pig_client.py
  51. 8 9
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/PIG/package/scripts/service_check.py
  52. 1 2
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/WEBHCAT/package/scripts/__init__.py
  53. 1 2
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/WEBHCAT/package/scripts/params.py
  54. 4 5
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/WEBHCAT/package/scripts/service_check.py
  55. 1 2
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/WEBHCAT/package/scripts/webhcat.py
  56. 1 2
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/WEBHCAT/package/scripts/webhcat_server.py
  57. 0 1
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/WEBHCAT/package/scripts/webhcat_service.py
  58. 1 2
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/package/scripts/__init__.py
  59. 1 2
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/package/scripts/application_timeline_server.py
  60. 0 1
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/package/scripts/historyserver.py
  61. 1 2
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/package/scripts/mapred_service_check.py
  62. 0 1
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/package/scripts/mapreduce2_client.py
  63. 0 1
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/package/scripts/nodemanager.py
  64. 0 1
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/package/scripts/params.py
  65. 0 1
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/package/scripts/resourcemanager.py
  66. 1 2
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/package/scripts/service.py
  67. 1 2
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/package/scripts/service_check.py
  68. 1 2
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/package/scripts/yarn.py
  69. 1 2
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/package/scripts/yarn_client.py
  70. 1 2
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/ZOOKEEPER/package/scripts/__init__.py
  71. 0 1
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/ZOOKEEPER/package/scripts/params.py
  72. 1 2
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/ZOOKEEPER/package/scripts/service_check.py
  73. 0 1
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/ZOOKEEPER/package/scripts/zookeeper.py
  74. 1 2
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/ZOOKEEPER/package/scripts/zookeeper_client.py
  75. 1 2
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/ZOOKEEPER/package/scripts/zookeeper_server.py
  76. 1 2
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/ZOOKEEPER/package/scripts/zookeeper_service.py
  77. 1 2
      ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/scripts/__init__.py
  78. 1 2
      ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/scripts/application_timeline_server.py
  79. 0 1
      ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/scripts/historyserver.py
  80. 1 2
      ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/scripts/mapred_service_check.py
  81. 0 1
      ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/scripts/mapreduce2_client.py
  82. 0 1
      ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/scripts/nodemanager.py
  83. 0 1
      ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/scripts/params.py
  84. 0 1
      ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/scripts/resourcemanager.py
  85. 1 2
      ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/scripts/service.py
  86. 1 2
      ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/scripts/service_check.py
  87. 1 2
      ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/scripts/yarn.py
  88. 1 2
      ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/scripts/yarn_client.py
  89. 0 1
      ambari-server/src/main/resources/stacks/HDP/2.1/services/TEZ/package/scripts/tez.py
  90. 0 1
      ambari-server/src/main/resources/stacks/HDP/2.1/services/TEZ/package/scripts/tez_client.py
  91. 1 2
      ambari-server/src/test/resources/stacks/HDP/2.0.6/hooks/dummy-script.py
  92. 1 2
      ambari-server/src/test/resources/stacks/HDP/2.0.7/services/HBASE/package/dummy-script.py
  93. 1 2
      ambari-server/src/test/resources/stacks/HDP/2.0.7/services/HDFS/package/dummy-script.py
  94. 1 2
      ambari-server/src/test/resources/stacks/HDP/2.0.8/hooks/dummy-script.py
  95. 1 2
      ambari-server/src/test/resources/stacks/HDP/2.0.8/services/HDFS/package/dummy-script.py

+ 6 - 2
ambari-agent/conf/unix/ambari-agent

@@ -49,7 +49,11 @@ OK=1
 NOTOK=0
 
 
-if [ -a /usr/bin/python2.6 ]; then
+if [ -a /usr/bin/python2.7 ] && [ -z "$PYTHON" ]; then
+  PYTHON=/usr/bin/python2.7
+fi
+
+if [ -a /usr/bin/python2.6 ] && [ -z "$PYTHON" ]; then
   PYTHON=/usr/bin/python2.6
 fi
 
@@ -207,7 +211,7 @@ case "$1" in
         $0 stop
         $0 start "$@"
         retcode=$?
-        ;;     
+        ;;
   *)
         tput bold
         echo "Usage: /usr/sbin/ambari-agent {start|stop|restart|status}"

+ 16 - 3
ambari-agent/conf/unix/install-helper.sh

@@ -22,19 +22,32 @@ COMMON_DIR="/usr/lib/python2.6/site-packages/common_functions"
 INSTALL_HELPER_SERVER="/var/lib/ambari-server/install-helper.sh"
 COMMON_DIR_AGENT="/usr/lib/ambari-agent/lib/common_functions"
 
+PYTHON_WRAPER_TARGET="/usr/bin/ambari-python-wrap"
+PYTHON_WRAPER_SOURCE="/var/lib/ambari-agent/ambari-python-wrap"
 
 do_install(){
+  # setting common_functions shared resource
   if [ ! -d "$COMMON_DIR" ]; then
     ln -s "$COMMON_DIR_AGENT" "$COMMON_DIR"
   fi
+  # setting python-wrapper script
+  if [ ! -f "$PYTHON_WRAPER_TARGET" ]; then
+    ln -s "$PYTHON_WRAPER_SOURCE" "$PYTHON_WRAPER_TARGET"
+  fi
 }
 
 do_remove(){
   if [ -d "$COMMON_DIR" ]; then  # common dir exists
     rm -f "$COMMON_DIR"
-    if [ -f "$INSTALL_HELPER_SERVER" ]; then  #  call server shared files installer
-      $INSTALL_HELPER_SERVER install
-    fi
+  fi
+
+  if [ -f "$PYTHON_WRAPER_TARGET" ]; then
+    rm -f "$PYTHON_WRAPER_TARGET"
+  fi
+
+  # if server package exists, restore their settings
+  if [ -f "$INSTALL_HELPER_SERVER" ]; then  #  call server shared files installer
+    $INSTALL_HELPER_SERVER install
   fi
 }
 

+ 26 - 3
ambari-agent/pom.xml

@@ -125,7 +125,7 @@
         <executions>
           <execution>
             <configuration>
-              <executable>python2.6</executable>
+              <executable>${project.basedir}/../ambari-common/src/main/unix/ambari-python-wrap</executable>
               <workingDirectory>src/test/python</workingDirectory>
               <arguments>
                 <argument>unitTests.py</argument>
@@ -144,7 +144,7 @@
           <execution>
             <!-- TODO: Looks like section is unused, maybe remove? -->
             <configuration>
-              <executable>python2.6</executable>
+              <executable>${project.basedir}/../ambari-common/src/main/unix/ambari-python-wrap</executable>
               <workingDirectory>target/ambari-agent-${project.version}</workingDirectory>
               <arguments>
                 <argument>${project.basedir}/src/main/python/setup.py</argument>
@@ -163,7 +163,7 @@
           </execution>
           <execution>
             <configuration>
-              <executable>python2.6</executable>
+              <executable>${project.basedir}/../ambari-common/src/main/unix/ambari-python-wrap</executable>
               <workingDirectory>${basedir}</workingDirectory>
               <arguments>
                 <argument>${resource.keeper.script}</argument>
@@ -227,6 +227,18 @@
                 </source>
               </sources>
             </mapping>
+            <mapping>
+              <directory>/var/lib/ambari-agent/</directory>
+              <filemode>755</filemode>
+              <username>root</username>
+              <groupname>root</groupname>
+              <directoryIncluded>false</directoryIncluded>
+              <sources>
+                <source>
+                  <location>../ambari-common/src/main/unix/ambari-python-wrap</location>
+                </source>
+              </sources>
+            </mapping>
             <mapping>
               <directory>${resmgmt.install.dir}</directory>
               <sources>
@@ -549,6 +561,17 @@
                 <filemode>755</filemode>
               </mapper>
             </data>
+            <data>
+              <src>../ambari-common/src/main/unix/ambari-python-wrap</src>
+              <type>file</type>
+              <mapper>
+                <type>perm</type>
+                <prefix>/var/lib/ambari-agent</prefix>
+                <user>root</user>
+                <group>root</group>
+                <filemode>755</filemode>
+              </mapper>
+            </data>
             <data>
               <src>${target.cache.dir}</src>
               <type>directory</type>

+ 3 - 3
ambari-agent/src/main/puppet/modules/hdp-yarn/files/validateYarnComponentStatus.py

@@ -1,4 +1,4 @@
-#!/usr/bin/env python2.6
+#!/usr/bin/env ambari-python-wrap
 
 '''
 Licensed to the Apache Software Foundation (ASF) under one
@@ -40,7 +40,7 @@ def getResponse(path, address, ssl_enabled):
     url = 'https://' + address + path
   else:
     url = 'http://' + address + path
-      
+
   command_with_flags = [command,httpGssnegotiate,userpswd,insecure,url]
   try:
     proc = subprocess.Popen(command_with_flags, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@@ -143,7 +143,7 @@ def main():
   (options, args) = parser.parse_args()
 
   component = args[0]
-  
+
   address = options.address
   ssl_enabled = (options.ssl_enabled) in 'true'
   if component == RESOURCEMANAGER:

+ 6 - 6
ambari-agent/src/main/python/ambari_agent/Facter.py

@@ -1,4 +1,4 @@
-#!/usr/bin/env python2.6
+#!/usr/bin/env ambari-python-wrap
 
 '''
 Licensed to the Apache Software Foundation (ASF) under one
@@ -42,9 +42,9 @@ GET_MEMINFO_CMD = "cat /proc/meminfo"
 
 class Facter():
   def __init__(self):
-    
-    self.DATA_IFCONFIG_OUTPUT = Facter.setDataIfConfigOutput()    
-    self.DATA_UPTIME_OUTPUT = Facter.setDataUpTimeOutput()    
+
+    self.DATA_IFCONFIG_OUTPUT = Facter.setDataIfConfigOutput()
+    self.DATA_UPTIME_OUTPUT = Facter.setDataUpTimeOutput()
     self.DATA_MEMINFO_OUTPUT = Facter.setMemInfoOutput()
 
   @staticmethod
@@ -189,7 +189,7 @@ class Facter():
 
   # Return first ip adress
   def getIpAddress(self):
-    result = self.data_return_first("(?: inet addr:)(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})", 
+    result = self.data_return_first("(?: inet addr:)(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})",
                                     self.DATA_IFCONFIG_OUTPUT)
     if result == '':
       log.warn("Can't get an ip address from {0}".format(self.DATA_IFCONFIG_OUTPUT))
@@ -199,7 +199,7 @@ class Facter():
 
   # Return  netmask
   def getNetmask(self):
-    result = self.data_return_first("(?: Mask:)(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})", 
+    result = self.data_return_first("(?: Mask:)(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})",
                                     self.DATA_IFCONFIG_OUTPUT)
     if result == '':
       log.warn("Can't get a netmask from {0}".format(self.DATA_IFCONFIG_OUTPUT))

+ 1 - 1
ambari-agent/src/main/python/resource_management/libraries/script/hook.py

@@ -1,4 +1,4 @@
-#!/usr/bin/env python2.6
+#!/usr/bin/env ambari-python-wrap
 
 '''
 Licensed to the Apache Software Foundation (ASF) under one

+ 2 - 2
ambari-client/pom.xml

@@ -72,7 +72,7 @@
         <executions>
           <execution>
             <configuration>
-              <executable>python2.6</executable>
+              <executable>${project.basedir}/../ambari-common/src/main/unix/ambari-python-wrap</executable>
               <workingDirectory>src/test/python</workingDirectory>
               <arguments>
                 <argument>unitTests.py</argument>
@@ -90,7 +90,7 @@
           </execution>
           <execution>
             <configuration>
-              <executable>python2.6</executable>
+              <executable>${project.basedir}/../ambari-common/src/main/unix/ambari-python-wrap</executable>
               <workingDirectory>target/ambari-client-${project.version}</workingDirectory>
               <arguments>
                 <argument>${project.basedir}/src/main/python/setup.py</argument>

+ 40 - 0
ambari-common/src/main/unix/ambari-python-wrap

@@ -0,0 +1,40 @@
+#!/usr/bin/env bash
+# Copyright 2011 The Apache Software Foundation
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+export PYTHONPATH=/usr/lib/python2.6/site-packages/common_functions:$PYTHONPATH
+
+# reset settings
+unset PYTHON
+
+# checking for preferable python versions
+if [ -a /usr/bin/python2.7 ] && [ -z "$PYTHON" ]; then
+  PYTHON=/usr/bin/python2.7
+fi
+
+if [ -a /usr/bin/python2.6 ] && [ -z "$PYTHON" ]; then
+  PYTHON=/usr/bin/python2.6
+fi
+
+# if no preferable python versions found, try to use system one
+if [[ -z "$PYTHON" ]]; then
+  PYTHON=/usr/bin/python
+fi
+
+# execute script
+$PYTHON $@

+ 15 - 2
ambari-server/conf/unix/install-helper.sh

@@ -21,19 +21,32 @@ COMMON_DIR="/usr/lib/python2.6/site-packages/common_functions"
 INSTALL_HELPER_AGENT="/var/lib/ambari-agent/install-helper.sh"
 COMMON_DIR_SERVER="/usr/lib/ambari-server/lib/common_functions"
 
+PYTHON_WRAPER_TARGET="/usr/bin/ambari-python-wrap"
+PYTHON_WRAPER_SOURCE="/var/lib/ambari-server/ambari-python-wrap"
 
 do_install(){
+  # setting common_functions shared resource
   if [ ! -d "$COMMON_DIR" ]; then
     ln -s "$COMMON_DIR_SERVER" "$COMMON_DIR"
   fi
+  # setting python-wrapper script
+  if [ ! -f "$PYTHON_WRAPER_TARGET" ]; then
+    ln -s "$PYTHON_WRAPER_SOURCE" "$PYTHON_WRAPER_TARGET"
+  fi
 }
 
 do_remove(){
   if [ -d "$COMMON_DIR" ]; then  # common dir exists
     rm -f "$COMMON_DIR"
-    if [ -f "$INSTALL_HELPER_AGENT" ]; then  #  call agent shared files installer
+  fi
+
+  if [ -f "$PYTHON_WRAPER_TARGET" ]; then
+    rm -f "$PYTHON_WRAPER_TARGET"
+  fi
+
+  # if server package exists, restore their settings
+  if [ -f "$INSTALL_HELPER_AGENT" ]; then  #  call agent shared files installer
       $INSTALL_HELPER_AGENT install
-    fi
   fi
 }
 

+ 24 - 1
ambari-server/pom.xml

@@ -285,6 +285,18 @@
                 </source>
               </sources>
             </mapping>
+            <mapping>
+              <directory>/var/lib/ambari-server/</directory>
+              <filemode>755</filemode>
+              <username>root</username>
+              <groupname>root</groupname>
+              <directoryIncluded>false</directoryIncluded>
+              <sources>
+                <source>
+                  <location>../ambari-common/src/main/unix/ambari-python-wrap</location>
+                </source>
+              </sources>
+            </mapping>
             <mapping>
               <directory>/etc/ambari-server/conf</directory>
               <configuration>true</configuration>
@@ -542,6 +554,17 @@
                 <filemode>755</filemode>
               </mapper>
             </data>
+            <data>
+              <src>../ambari-common/src/main/unix/ambari-python-wrap</src>
+              <type>file</type>
+              <mapper>
+                <type>perm</type>
+                <prefix>/var/lib/ambari-server</prefix>
+                <user>root</user>
+                <group>root</group>
+                <filemode>755</filemode>
+              </mapper>
+            </data>
             <data>
               <src>${basedir}/target/ambari-server</src>
               <type>file</type>
@@ -851,7 +874,7 @@
         <executions>
           <execution>
             <configuration>
-              <executable>python2.6</executable>
+              <executable>${project.basedir}/../ambari-common/src/main/unix/ambari-python-wrap</executable>
               <workingDirectory>src/test/python</workingDirectory>
               <arguments>
                 <argument>unitTests.py</argument>

+ 5 - 1
ambari-server/sbin/ambari-server

@@ -41,7 +41,11 @@ export AMBARI_CONF_DIR=/etc/ambari-server/conf:$PATH
 # Because Ambari rpm unpacks modules here on all systems
 export PYTHONPATH=/usr/lib/python2.6/site-packages:$PYTHONPATH
 
-if [ -a /usr/bin/python2.6 ]; then
+if [ -a /usr/bin/python2.7 ] && [ -z "$PYTHON" ]; then
+  PYTHON=/usr/bin/python2.7
+fi
+
+if [ -a /usr/bin/python2.6 ] && [ -z "$PYTHON" ]; then
   PYTHON=/usr/bin/python2.6
 fi
 

+ 1 - 1
ambari-server/src/main/python/bootstrap.py

@@ -1,4 +1,4 @@
-#!/usr/bin/env python2.6
+#!/usr/bin/env ambari-python-wrap
 
 '''
 Licensed to the Apache Software Foundation (ASF) under one

+ 0 - 1
ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/after-INSTALL/scripts/hook.py

@@ -1,4 +1,3 @@
-##!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file

+ 0 - 1
ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-INSTALL/scripts/hook.py

@@ -1,4 +1,3 @@
-##!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file

+ 0 - 2
ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-RESTART/scripts/hook.py

@@ -1,5 +1,3 @@
-##!/usr/bin/env python2.6
-
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file

+ 0 - 1
ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-START/scripts/hook.py

@@ -1,4 +1,3 @@
-##!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HDFS/package/scripts/hdfs.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -60,4 +59,4 @@ def hdfs(name=None):
   File(os.path.join(params.hadoop_conf_dir, 'slaves'),
        owner=tc_owner,
        content=Template("slaves.j2")
-  )
+  )

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/MAPREDUCE/package/scripts/client.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -40,4 +39,4 @@ class Client(Script):
     raise ClientComponentHasNoStatus()
 
 if __name__ == "__main__":
-  Client().execute()
+  Client().execute()

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/MAPREDUCE/package/scripts/historyserver.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -28,7 +27,7 @@ from service import service
 class Historyserver(Script):
   def install(self, env):
     self.install_packages(env)
-  
+
   def configure(self, env):
     import params
     env.set_params(params)

+ 2 - 3
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/MAPREDUCE/package/scripts/jobtracker.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -42,7 +41,7 @@ class Jobtracker(Script):
     service('jobtracker',
             action='start'
     )
-    
+
   def stop(self, env):
     import params
     env.set_params(params)
@@ -50,7 +49,7 @@ class Jobtracker(Script):
     service('jobtracker',
             action='stop'
     )
-    
+
   def status(self, env):
     import status_params
     env.set_params(status_params)

+ 0 - 1
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/MAPREDUCE/package/scripts/mapreduce.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file

+ 0 - 1
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/MAPREDUCE/package/scripts/params.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/MAPREDUCE/package/scripts/service.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -53,4 +52,4 @@ def service(
     Execute(daemon_cmd,
             user=params.mapred_user
     )
-    Execute(rm_pid)
+    Execute(rm_pid)

+ 1 - 3
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/MAPREDUCE/package/scripts/service_check.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -20,7 +19,6 @@ Ambari Agent
 
 """
 
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -86,4 +84,4 @@ class ServiceCheck(Script):
     )
 
 if __name__ == "__main__":
-  ServiceCheck().execute()
+  ServiceCheck().execute()

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/MAPREDUCE/package/scripts/status_params.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -30,4 +29,4 @@ mapred_pid_dir = format("{pid_dir_prefix}/{mapred_user}")
 
 jobtracker_pid_file = format("{mapred_pid_dir}/hadoop-{mapred_user}-jobtracker.pid")
 tasktracker_pid_file = format("{mapred_pid_dir}/hadoop-{mapred_user}-tasktracker.pid")
-historyserver_pid_file = format("{mapred_pid_dir}/hadoop-{mapred_user}-historyserver.pid")
+historyserver_pid_file = format("{mapred_pid_dir}/hadoop-{mapred_user}-historyserver.pid")

+ 1 - 4
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/MAPREDUCE/package/scripts/tasktracker.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -20,7 +19,6 @@ Ambari Agent
 
 """
 
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -42,7 +40,6 @@ Ambari Agent
 
 """
 
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -101,4 +98,4 @@ class Tasktracker(Script):
     check_process_status(status_params.tasktracker_pid_file)
 
 if __name__ == "__main__":
-  Tasktracker().execute()
+  Tasktracker().execute()

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/PIG/package/scripts/params.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -43,4 +42,4 @@ hadoop_home = "/usr"
 if (('pig-log4j' in config['configurations']) and ('content' in config['configurations']['pig-log4j'])):
   log4j_props = config['configurations']['pig-log4j']['content']
 else:
-  log4j_props = None
+  log4j_props = None

+ 5 - 6
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/PIG/package/scripts/pig.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -46,16 +45,16 @@ def pig():
          group=params.user_group,
          owner=params.hdfs_user
     )
-  
-  
+
+
 def pig_TemplateConfig(name):
   import params
-  
+
   if not isinstance(name, list):
     name = [name]
-    
+
   for x in name:
     TemplateConfig( format("{pig_conf_dir}/{x}"),
         owner = params.hdfs_user
     )
-  
+

+ 3 - 4
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/PIG/package/scripts/pig_client.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -24,12 +23,12 @@ import sys
 from resource_management import *
 from pig import pig
 
-         
+
 class PigClient(Script):
   def install(self, env):
     self.install_packages(env)
     self.configure(env)
-    
+
   def configure(self, env):
     import params
     env.set_params(params)
@@ -37,6 +36,6 @@ class PigClient(Script):
 
   def status(self, env):
     raise ClientComponentHasNoStatus()
-    
+
 if __name__ == "__main__":
   PigClient().execute()

+ 8 - 9
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/PIG/package/scripts/service_check.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -26,15 +25,15 @@ class PigServiceCheck(Script):
   def service_check(self, env):
     import params
     env.set_params(params)
-    
+
     input_file = 'passwd'
     output_file = "pigsmoke.out"
-  
+
     cleanup_cmd = format("dfs -rmr {output_file} {input_file}")
     #cleanup put below to handle retries; if retrying there wil be a stale file that needs cleanup; exit code is fn of second command
     create_file_cmd = format("{cleanup_cmd}; hadoop dfs -put /etc/passwd {input_file} ") #TODO: inconsistent that second command needs hadoop
     test_cmd = format("fs -test -e {output_file}")
-  
+
     ExecuteHadoop( create_file_cmd,
       tries     = 3,
       try_sleep = 5,
@@ -45,24 +44,24 @@ class PigServiceCheck(Script):
       security_enabled = params.security_enabled,
       kinit_path_local = params.kinit_path_local
     )
-  
+
     File( '/tmp/pigSmoke.sh',
       content = StaticFile("pigSmoke.sh"),
       mode = 0755
     )
-  
+
     Execute( "pig /tmp/pigSmoke.sh",
       tries     = 3,
       try_sleep = 5,
       path      = '/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin',
       user      = params.smokeuser
     )
-  
+
     ExecuteHadoop( test_cmd,
       user      = params.smokeuser,
       conf_dir = params.hadoop_conf_dir
     )
-    
+
 if __name__ == "__main__":
   PigServiceCheck().execute()
-  
+

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/WEBHCAT/package/scripts/__init__.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -18,4 +17,4 @@ limitations under the License.
 
 Ambari Agent
 
-"""
+"""

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/WEBHCAT/package/scripts/params.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -75,4 +74,4 @@ HdfsDirectory = functools.partial(
   security_enabled = security_enabled,
   keytab = hdfs_user_keytab,
   kinit_path_local = kinit_path_local
-)
+)

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/WEBHCAT/package/scripts/service_check.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -42,4 +41,4 @@ class WebHCatServiceCheck(Script):
             logoutput=True)
 
 if __name__ == "__main__":
-  WebHCatServiceCheck().execute()
+  WebHCatServiceCheck().execute()

+ 0 - 1
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/WEBHCAT/package/scripts/webhcat.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/WEBHCAT/package/scripts/webhcat_server.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -51,4 +50,4 @@ class WebHCatServer(Script):
     check_process_status(status_params.pid_file)
 
 if __name__ == "__main__":
-  WebHCatServer().execute()
+  WebHCatServer().execute()

+ 0 - 1
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/WEBHCAT/package/scripts/webhcat_service.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/ZOOKEEPER/package/scripts/__init__.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -18,4 +17,4 @@ limitations under the License.
 
 Ambari Agent
 
-"""
+"""

+ 0 - 1
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/ZOOKEEPER/package/scripts/params.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/ZOOKEEPER/package/scripts/service_check.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -44,4 +43,4 @@ class ZookeeperServiceCheck(Script):
     )
 
 if __name__ == "__main__":
-  ZookeeperServiceCheck().execute()
+  ZookeeperServiceCheck().execute()

+ 0 - 1
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/ZOOKEEPER/package/scripts/zookeeper.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/ZOOKEEPER/package/scripts/zookeeper_client.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -40,4 +39,4 @@ class ZookeeperClient(Script):
     raise ClientComponentHasNoStatus()
 
 if __name__ == "__main__":
-  ZookeeperClient().execute()
+  ZookeeperClient().execute()

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/ZOOKEEPER/package/scripts/zookeeper_server.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -52,4 +51,4 @@ class ZookeeperServer(Script):
     check_process_status(status_params.zk_pid_file)
 
 if __name__ == "__main__":
-  ZookeeperServer().execute()
+  ZookeeperServer().execute()

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/1.3.2/services/ZOOKEEPER/package/scripts/zookeeper_service.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -40,4 +39,4 @@ def zookeeper_service(action='start'):
     Execute(daemon_cmd,
             user=params.zk_user
     )
-    Execute(rm_pid)
+    Execute(rm_pid)

+ 0 - 1
ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-INSTALL/scripts/hook.py

@@ -1,4 +1,3 @@
-##!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file

+ 0 - 2
ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-RESTART/scripts/hook.py

@@ -1,5 +1,3 @@
-##!/usr/bin/env python2.6
-
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file

+ 0 - 1
ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/hook.py

@@ -1,4 +1,3 @@
-##!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HDFS/package/scripts/hdfs.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -60,4 +59,4 @@ def hdfs(name=None):
   File(os.path.join(params.hadoop_conf_dir, 'slaves'),
        owner=tc_owner,
        content=Template("slaves.j2")
-  )
+  )

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/PIG/package/scripts/params.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -43,4 +42,4 @@ hadoop_home = "/usr"
 if (('pig-log4j' in config['configurations']) and ('content' in config['configurations']['pig-log4j'])):
   log4j_props = config['configurations']['pig-log4j']['content']
 else:
-  log4j_props = None
+  log4j_props = None

+ 3 - 4
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/PIG/package/scripts/pig.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -49,12 +48,12 @@ def pig():
 
 def pig_TemplateConfig(name):
   import params
-  
+
   if not isinstance(name, list):
     name = [name]
-    
+
   for x in name:
     TemplateConfig( format("{pig_conf_dir}/{x}"),
         owner = params.hdfs_user
     )
-  
+

+ 3 - 4
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/PIG/package/scripts/pig_client.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -24,12 +23,12 @@ import sys
 from resource_management import *
 from pig import pig
 
-         
+
 class PigClient(Script):
   def install(self, env):
     self.install_packages(env)
     self.configure(env)
-    
+
   def configure(self, env):
     import params
     env.set_params(params)
@@ -37,6 +36,6 @@ class PigClient(Script):
 
   def status(self, env):
     raise ClientComponentHasNoStatus()
-    
+
 if __name__ == "__main__":
   PigClient().execute()

+ 8 - 9
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/PIG/package/scripts/service_check.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -26,15 +25,15 @@ class PigServiceCheck(Script):
   def service_check(self, env):
     import params
     env.set_params(params)
-    
+
     input_file = 'passwd'
     output_file = "pigsmoke.out"
-  
+
     cleanup_cmd = format("dfs -rmr {output_file} {input_file}")
     #cleanup put below to handle retries; if retrying there wil be a stale file that needs cleanup; exit code is fn of second command
     create_file_cmd = format("{cleanup_cmd}; hadoop dfs -put /etc/passwd {input_file} ") #TODO: inconsistent that second command needs hadoop
     test_cmd = format("fs -test -e {output_file}")
-  
+
     ExecuteHadoop( create_file_cmd,
       tries     = 3,
       try_sleep = 5,
@@ -45,24 +44,24 @@ class PigServiceCheck(Script):
       security_enabled = params.security_enabled,
       kinit_path_local = params.kinit_path_local
     )
-  
+
     File( '/tmp/pigSmoke.sh',
       content = StaticFile("pigSmoke.sh"),
       mode = 0755
     )
-  
+
     Execute( "pig /tmp/pigSmoke.sh",
       tries     = 3,
       try_sleep = 5,
       path      = '/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin',
       user      = params.smokeuser
     )
-  
+
     ExecuteHadoop( test_cmd,
       user      = params.smokeuser,
       conf_dir = params.hadoop_conf_dir
     )
-    
+
 if __name__ == "__main__":
   PigServiceCheck().execute()
-  
+

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/WEBHCAT/package/scripts/__init__.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -18,4 +17,4 @@ limitations under the License.
 
 Ambari Agent
 
-"""
+"""

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/WEBHCAT/package/scripts/params.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -80,4 +79,4 @@ HdfsDirectory = functools.partial(
   security_enabled = security_enabled,
   keytab = hdfs_user_keytab,
   kinit_path_local = kinit_path_local
-)
+)

+ 4 - 5
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/WEBHCAT/package/scripts/service_check.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -24,14 +23,14 @@ from resource_management import *
 class WebHCatServiceCheck(Script):
   def service_check(self, env):
     import params
-    
+
     env.set_params(params)
-    
+
     File('/tmp/templetonSmoke.sh',
          content= StaticFile('templetonSmoke.sh'),
          mode=0755
     )
-    
+
     cmd = format("/tmp/templetonSmoke.sh {webhcat_server_host[0]} {smokeuser} {smokeuser_keytab}"
                  " {security_param} {kinit_path_local}",
                  smokeuser_keytab=params.smoke_user_keytab if params.security_enabled else "no_keytab")
@@ -43,4 +42,4 @@ class WebHCatServiceCheck(Script):
             logoutput=True)
 
 if __name__ == "__main__":
-  WebHCatServiceCheck().execute()
+  WebHCatServiceCheck().execute()

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/WEBHCAT/package/scripts/webhcat.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -106,4 +105,4 @@ def webhcat():
                 dest_dir=params.webhcat_apps_dir,
                 kinnit_if_needed=kinit_if_needed,
                 hdfs_user=params.hdfs_user
-  )
+  )

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/WEBHCAT/package/scripts/webhcat_server.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -51,4 +50,4 @@ class WebHCatServer(Script):
     check_process_status(status_params.pid_file)
 
 if __name__ == "__main__":
-  WebHCatServer().execute()
+  WebHCatServer().execute()

+ 0 - 1
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/WEBHCAT/package/scripts/webhcat_service.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/package/scripts/__init__.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -18,4 +17,4 @@ limitations under the License.
 
 Ambari Agent
 
-"""
+"""

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/package/scripts/application_timeline_server.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -53,4 +52,4 @@ class ApplicationTimelineServer(Script):
     check_process_status(status_params.yarn_historyserver_pid_file)
 
 if __name__ == "__main__":
-  ApplicationTimelineServer().execute()
+  ApplicationTimelineServer().execute()

+ 0 - 1
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/package/scripts/historyserver.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/package/scripts/mapred_service_check.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -71,4 +70,4 @@ class MapReduce2ServiceCheck(Script):
     )
 
 if __name__ == "__main__":
-  MapReduce2ServiceCheck().execute()
+  MapReduce2ServiceCheck().execute()

+ 0 - 1
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/package/scripts/mapreduce2_client.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file

+ 0 - 1
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/package/scripts/nodemanager.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file

+ 0 - 1
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/package/scripts/params.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file

+ 0 - 1
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/package/scripts/resourcemanager.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/package/scripts/service.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -60,4 +59,4 @@ def service(componentName, action='start', serviceName='yarn'):
     rm_pid = format("rm -f {pid_file}")
     Execute(rm_pid,
             user=usr
-    )
+    )

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/package/scripts/service_check.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -65,4 +64,4 @@ class ServiceCheck(Script):
     )
 
 if __name__ == "__main__":
-  ServiceCheck().execute()
+  ServiceCheck().execute()

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/package/scripts/yarn.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -144,7 +143,7 @@ def yarn(name = None):
          group=params.yarn_executor_container_group,
          mode=06050
     )
-    
+
     File(format("{config_dir}/container-executor.cfg"),
          group=params.user_group,
          mode=0644,

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/package/scripts/yarn_client.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -40,4 +39,4 @@ class YarnClient(Script):
     raise ClientComponentHasNoStatus()
 
 if __name__ == "__main__":
-  YarnClient().execute()
+  YarnClient().execute()

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/ZOOKEEPER/package/scripts/__init__.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -18,4 +17,4 @@ limitations under the License.
 
 Ambari Agent
 
-"""
+"""

+ 0 - 1
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/ZOOKEEPER/package/scripts/params.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/ZOOKEEPER/package/scripts/service_check.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -44,4 +43,4 @@ class ZookeeperServiceCheck(Script):
     )
 
 if __name__ == "__main__":
-  ZookeeperServiceCheck().execute()
+  ZookeeperServiceCheck().execute()

+ 0 - 1
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/ZOOKEEPER/package/scripts/zookeeper.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/ZOOKEEPER/package/scripts/zookeeper_client.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -40,4 +39,4 @@ class ZookeeperClient(Script):
     raise ClientComponentHasNoStatus()
 
 if __name__ == "__main__":
-  ZookeeperClient().execute()
+  ZookeeperClient().execute()

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/ZOOKEEPER/package/scripts/zookeeper_server.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -52,4 +51,4 @@ class ZookeeperServer(Script):
     check_process_status(status_params.zk_pid_file)
 
 if __name__ == "__main__":
-  ZookeeperServer().execute()
+  ZookeeperServer().execute()

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/ZOOKEEPER/package/scripts/zookeeper_service.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -40,4 +39,4 @@ def zookeeper_service(action='start'):
     Execute(daemon_cmd,
             user=params.zk_user
     )
-    Execute(rm_pid)
+    Execute(rm_pid)

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/scripts/__init__.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -18,4 +17,4 @@ limitations under the License.
 
 Ambari Agent
 
-"""
+"""

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/scripts/application_timeline_server.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -53,4 +52,4 @@ class ApplicationTimelineServer(Script):
     check_process_status(status_params.yarn_historyserver_pid_file)
 
 if __name__ == "__main__":
-  ApplicationTimelineServer().execute()
+  ApplicationTimelineServer().execute()

+ 0 - 1
ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/scripts/historyserver.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/scripts/mapred_service_check.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -71,4 +70,4 @@ class MapReduce2ServiceCheck(Script):
     )
 
 if __name__ == "__main__":
-  MapReduce2ServiceCheck().execute()
+  MapReduce2ServiceCheck().execute()

+ 0 - 1
ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/scripts/mapreduce2_client.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file

+ 0 - 1
ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/scripts/nodemanager.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file

+ 0 - 1
ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/scripts/params.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file

+ 0 - 1
ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/scripts/resourcemanager.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/scripts/service.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -60,4 +59,4 @@ def service(componentName, action='start', serviceName='yarn'):
     rm_pid = format("rm -f {pid_file}")
     Execute(rm_pid,
             user=usr
-    )
+    )

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/scripts/service_check.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -65,4 +64,4 @@ class ServiceCheck(Script):
     )
 
 if __name__ == "__main__":
-  ServiceCheck().execute()
+  ServiceCheck().execute()

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/scripts/yarn.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -150,7 +149,7 @@ def yarn(name = None):
          group=params.yarn_executor_container_group,
          mode=06050
     )
-    
+
     File(format("{config_dir}/container-executor.cfg"),
          group=params.user_group,
          mode=0644,

+ 1 - 2
ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/scripts/yarn_client.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -40,4 +39,4 @@ class YarnClient(Script):
     raise ClientComponentHasNoStatus()
 
 if __name__ == "__main__":
-  YarnClient().execute()
+  YarnClient().execute()

+ 0 - 1
ambari-server/src/main/resources/stacks/HDP/2.1/services/TEZ/package/scripts/tez.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file

+ 0 - 1
ambari-server/src/main/resources/stacks/HDP/2.1/services/TEZ/package/scripts/tez_client.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file

+ 1 - 2
ambari-server/src/test/resources/stacks/HDP/2.0.6/hooks/dummy-script.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -18,4 +17,4 @@ limitations under the License.
 
 Ambari Agent
 
-"""
+"""

+ 1 - 2
ambari-server/src/test/resources/stacks/HDP/2.0.7/services/HBASE/package/dummy-script.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -18,4 +17,4 @@ limitations under the License.
 
 Ambari Agent
 
-"""
+"""

+ 1 - 2
ambari-server/src/test/resources/stacks/HDP/2.0.7/services/HDFS/package/dummy-script.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -18,4 +17,4 @@ limitations under the License.
 
 Ambari Agent
 
-"""
+"""

+ 1 - 2
ambari-server/src/test/resources/stacks/HDP/2.0.8/hooks/dummy-script.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -18,4 +17,4 @@ limitations under the License.
 
 Ambari Agent
 
-"""
+"""

+ 1 - 2
ambari-server/src/test/resources/stacks/HDP/2.0.8/services/HDFS/package/dummy-script.py

@@ -1,4 +1,3 @@
-#!/usr/bin/env python2.6
 """
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -18,4 +17,4 @@ limitations under the License.
 
 Ambari Agent
 
-"""
+"""