Преглед изворни кода

AMBARI-1424. Upgrade enhancements for Ambari 1.3.0. (smohanty)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1464626 13f79535-47bb-0310-9956-ffa450edef68
Sumit Mohanty пре 12 година
родитељ
комит
9d72065493

+ 2 - 0
CHANGES.txt

@@ -12,6 +12,8 @@ Trunk (unreleased changes):
 
  NEW FEATURES
 
+ AMBARI-1424. Upgrade enhancements for Ambari 1.3.0. (smohanty)
+
  AMBARI-1763. Integrate Frontend security work to enable security on
  HBase and ZooKeeper. (jaimin)
 

+ 6 - 5
ambari-agent/pom.xml

@@ -34,7 +34,6 @@
     <final.name>${project.artifactId}-${project.version}</final.name>
     <package.release>1</package.release>
     <package.prefix>/usr</package.prefix>
-    <package.conf.dir>/etc/ambari-agent/conf</package.conf.dir>
     <package.log.dir>/var/log/ambari-agent</package.log.dir>
     <package.pid.dir>/var/run/ambari-agent</package.pid.dir>
     <skipTests>false</skipTests>
@@ -43,6 +42,7 @@
     <install.dir>/usr/lib/python2.6/site-packages/ambari_agent</install.dir>
     <ruby.tar>http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.15/repos/centos6/ruby-1.8.7-p370.tar.gz</ruby.tar>
     <lib.dir>/usr/lib/ambari-agent/lib</lib.dir>
+    <python.ver>python &gt;= 2.6</python.ver>
   </properties>
   <profiles>
     <profile>
@@ -132,6 +132,7 @@
         <version>2.0.1</version>
         <executions>
           <execution>
+            <!-- unbinds rpm creation from maven lifecycle -->
             <phase>none</phase>
             <goals>
               <goal>rpm</goal>
@@ -147,7 +148,7 @@
             <require>zlib</require>
             <require>${python.ver}</require>
           </requires>
-           <postinstallScriptlet>
+          <postinstallScriptlet>
             <scriptFile>src/main/package/rpm/postinstall.sh</scriptFile>
             <fileEncoding>utf-8</fileEncoding>
           </postinstallScriptlet>
@@ -156,7 +157,8 @@
             <fileEncoding>utf-8</fileEncoding>
           </preinstallScriptlet>
           <preremoveScriptlet>
-            <script>mv /etc/ambari-agent/conf /etc/ambari-agent/conf.save</script>
+            <scriptFile>src/main/package/rpm/preremove.sh</scriptFile>
+            <fileEncoding>utf-8</fileEncoding>
           </preremoveScriptlet>
 
           <needarch>x86_64</needarch>
@@ -215,8 +217,7 @@
               </sources>
             </mapping>
             <mapping>
-              <directory>${package.conf.dir}</directory>
-              <configuration>true</configuration>
+              <directory>/etc/ambari-agent/conf</directory>
               <filemode>755</filemode>
               <username>root</username>
               <groupname>root</groupname>

+ 11 - 0
ambari-agent/src/main/package/rpm/postinstall.sh

@@ -14,3 +14,14 @@
 # limitations under the License
 
 chmod 755 /usr/lib/ambari-agent/lib/facter-1.6.10/bin/facter /usr/lib/ambari-agent/lib/puppet-2.7.9/bin/filebucket /usr/lib/ambari-agent/lib/puppet-2.7.9/bin/pi /usr/lib/ambari-agent/lib/puppet-2.7.9/bin/puppet /usr/lib/ambari-agent/lib/puppet-2.7.9/bin/puppetdoc /usr/lib/ambari-agent/lib/puppet-2.7.9/bin/ralsh /usr/lib/ambari-agent/lib/ruby-1.8.7-p370/bin/*
+
+BAK=/etc/ambari-agent/conf/ambari-agent.ini.old
+ORIG=/etc/ambari-agent/conf/ambari-agent.ini
+
+if [ -f $BAK ];
+then
+  SERV_HOST=`grep -e hostname\s*= $BAK | sed -r -e 's/hostname\s*=//' -e 's/\./\\\./g'`
+  sed -i -r -e "s/(hostname\s*=).*/\1$SERV_HOST/" $ORIG
+  rm $BAK -f
+fi
+exit 0

+ 7 - 0
ambari-agent/src/main/package/rpm/preinstall.sh

@@ -15,3 +15,10 @@
 
 getent group puppet >/dev/null || groupadd -r puppet
 getent passwd puppet >/dev/null || /usr/sbin/useradd -g puppet puppet
+
+BAK=/etc/ambari-agent/conf/ambari-agent.ini.old
+ORIG=/etc/ambari-agent/conf/ambari-agent.ini
+
+[ -f $ORIG ] && mv -f $ORIG $BAK
+
+exit 0

+ 25 - 0
ambari-agent/src/main/package/rpm/preremove.sh

@@ -0,0 +1,25 @@
+# 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
+
+# WARNING: This script is performed not only on uninstall, but also
+# during package update. See http://www.ibm.com/developerworks/library/l-rpm2/
+# for details
+
+if [ "$1" -eq 0 ]; # Action is uninstall
+then
+    mv /etc/ambari-agent/conf /etc/ambari-agent/conf.save
+fi
+
+exit 0

+ 25 - 9
ambari-server/pom.xml

@@ -110,12 +110,6 @@
           </execution>
         </executions>
         <configuration>
-          <!-- places rpm to specified folder -->
-          <!--
-          <workarea>
-            rpm-target
-          </workarea>
-          -->
           <copyright>2012, Apache Software Foundation</copyright>
           <version>${project.version}</version>
           <group>Development</group>
@@ -125,9 +119,19 @@
             <require>openssl</require>
             <require>${python.ver}</require>
           </requires>
+          <postinstallScriptlet>
+            <scriptFile>src/main/package/rpm/postinstall.sh</scriptFile>
+            <fileEncoding>utf-8</fileEncoding>
+          </postinstallScriptlet>
+          <preinstallScriptlet>
+            <scriptFile>src/main/package/rpm/preinstall.sh</scriptFile>
+            <fileEncoding>utf-8</fileEncoding>
+          </preinstallScriptlet>
           <preremoveScriptlet>
-            <script>mv /etc/ambari-server/conf /etc/ambari-server/conf.save</script>
+            <scriptFile>src/main/package/rpm/preremove.sh</scriptFile>
+            <fileEncoding>utf-8</fileEncoding>
           </preremoveScriptlet>
+
           <mappings>
             <mapping>
               <directory>/usr/lib/ambari-server</directory>
@@ -293,13 +297,25 @@
               </sources>
             </mapping>
             <mapping>
-              <directory>/var/lib/ambari-server/resources/stacks</directory>
+              <directory>/var/lib/ambari-server/resources/stacks/HDP</directory>
+              <filemode>755</filemode>
+              <username>root</username>
+              <groupname>root</groupname>
+              <sources>
+                <source>
+                  <location>src/main/resources/stacks/HDP</location>
+                </source>
+              </sources>
+            </mapping>
+            <mapping>
+              <directory>/var/lib/ambari-server/resources/stacks/HDPLocal</directory>
               <filemode>755</filemode>
               <username>root</username>
               <groupname>root</groupname>
+              <configuration>noreplace</configuration>
               <sources>
                 <source>
-                  <location>src/main/resources/stacks</location>
+                  <location>src/main/resources/stacks/HDPLocal</location>
                 </source>
               </sources>
             </mapping>

+ 16 - 0
ambari-server/src/main/package/rpm/postinstall.sh

@@ -0,0 +1,16 @@
+# 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
+
+exit 0

+ 16 - 0
ambari-server/src/main/package/rpm/preinstall.sh

@@ -0,0 +1,16 @@
+# 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
+
+exit 0

+ 25 - 0
ambari-server/src/main/package/rpm/preremove.sh

@@ -0,0 +1,25 @@
+# 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
+
+# WARNING: This script is performed not only on uninstall, but also
+# during package update. See http://www.ibm.com/developerworks/library/l-rpm2/
+# for details
+
+if [ "$1" -eq 0 ]; # Action is uninstall
+then
+    mv /etc/ambari-server/conf /etc/ambari-server/conf.save
+fi
+
+exit 0