You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by vi...@apache.org on 2012/06/09 03:43:24 UTC

svn commit: r1348295 - in /incubator/ambari/branches/ambari-186: ./ hmc/package/rpm/SOURCES/ hmc/package/rpm/SPECS/

Author: vikram
Date: Sat Jun  9 01:43:23 2012
New Revision: 1348295

URL: http://svn.apache.org/viewvc?rev=1348295&view=rev
Log:
AMBARI-542. Rename HMC to Ambari in user-facing init.d scripts (Contributed by Varun)

Added:
    incubator/ambari/branches/ambari-186/hmc/package/rpm/SOURCES/ambari-agent.init.in
    incubator/ambari/branches/ambari-186/hmc/package/rpm/SOURCES/ambari.init.in
Removed:
    incubator/ambari/branches/ambari-186/hmc/package/rpm/SOURCES/hmc-agent.init.in
    incubator/ambari/branches/ambari-186/hmc/package/rpm/SOURCES/hmc.init.in
Modified:
    incubator/ambari/branches/ambari-186/CHANGES.txt
    incubator/ambari/branches/ambari-186/hmc/package/rpm/SPECS/hmc.spec

Modified: incubator/ambari/branches/ambari-186/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/CHANGES.txt?rev=1348295&r1=1348294&r2=1348295&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/CHANGES.txt (original)
+++ incubator/ambari/branches/ambari-186/CHANGES.txt Sat Jun  9 01:43:23 2012
@@ -4,7 +4,9 @@ Note: Committers should be listed using 
 should be listed by their full name. Please keep the file to a max of 80
 characters wide.
 
-Release 0.1.x - unreleased
+Release 1.0.0 - unreleased
+
+  AMBARI-542. Rename HMC to Ambari in user-facing init.d scripts (Varun via Vikram)
 
   AMBARI-540. Naming cleanup required for management console. (Vikram via reznor)
 

Added: incubator/ambari/branches/ambari-186/hmc/package/rpm/SOURCES/ambari-agent.init.in
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/package/rpm/SOURCES/ambari-agent.init.in?rev=1348295&view=auto
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/package/rpm/SOURCES/ambari-agent.init.in (added)
+++ incubator/ambari/branches/ambari-186/hmc/package/rpm/SOURCES/ambari-agent.init.in Sat Jun  9 01:43:23 2012
@@ -0,0 +1,131 @@
+#! /bin/bash
+#
+# ambari-agent Bring up/down ambari-agent
+#
+# chkconfig: 345 20 80
+# description: Starts and stops the agent 
+#
+# /etc/rc.d/init.d/ambari-agent
+# See how we were called.
+#/*
+# * 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.
+# */
+
+#
+# RPM Init file for puppet agent
+#
+
+PATH=/usr/bin:/sbin:/bin:/usr/sbin
+export PATH
+
+[ -f /etc/sysconfig/puppet ] && . /etc/sysconfig/puppet
+lockfile=${LOCKFILE-/var/lock/subsys/puppet}
+pidfile=${PIDFILE-/var/run/puppet/agent.pid}
+puppetd=${PUPPETD-/usr/bin/puppet}
+RETVAL=0
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+# Determine if we can use the -p option to daemon, killproc, and status.
+# RHEL < 5 can't.
+if status | grep -q -- '-p' 2>/dev/null; then
+    daemonopts="--pidfile $pidfile"
+    pidopts="-p $pidfile"
+fi
+hmc_server=`cat /etc/hmc/hmc-agent.conf`
+PUPPET_OPTS="agent --verbose --confdir=/etc/puppet/agent --listen --runinterval 5 --server $hmc_server --report --no-client --waitforcert 10 --configtimeout 600 --debug --logdest=/var/log/puppet_agent.log --httplog /var/log/puppet_agent_http.log --autoflush --use_cached_catalog"
+
+start() {
+    echo -n $"Starting puppet: "
+    daemon $daemonopts $puppetd ${PUPPET_OPTS} ${PUPPET_EXTRA_OPTS}
+    RETVAL=$?
+    echo
+    [ $RETVAL = 0 ] && touch ${lockfile}
+    return $RETVAL
+}
+
+stop() {
+    echo -n $"Stopping puppet: "
+    killproc $puppetd
+    RETVAL=$?
+    echo
+    [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
+    return $RETVAL
+}
+
+reload() {
+    echo -n $"Restarting puppet: "
+    killproc  $puppetd -HUP
+    RETVAL=$?
+    echo
+    return $RETVAL
+}
+
+restart() {
+    stop
+    start
+}
+
+rh_status() {
+    status  $puppetd
+    RETVAL=$?
+    return $RETVAL
+}
+
+rh_status_q() {
+    rh_status >/dev/null 2>&1
+}
+
+genconfig() {
+    echo -n $"Generate configuration puppet: "
+    $puppetd ${PUPPET_OPTS} ${PUPPET_EXTRA_OPTS} --genconfig
+}
+
+case "$1" in
+    start)
+        start
+    ;;
+    stop)
+        stop
+    ;;
+    restart)
+        restart
+    ;;
+    reload|force-reload)
+        reload
+    ;;
+    condrestart|try-restart)
+        rh_status_q || exit 0
+        restart
+    ;;
+    status)
+        rh_status
+    ;;
+    once)
+        shift
+        $puppetd -o ${PUPPET_OPTS} ${PUPPET_EXTRA_OPTS} $@
+        ;;
+    genconfig)
+        genconfig
+    ;;
+    *)
+        echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart|once|genconfig}"
+        exit 1
+esac
+exit $RETVAL
+

Added: incubator/ambari/branches/ambari-186/hmc/package/rpm/SOURCES/ambari.init.in
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/package/rpm/SOURCES/ambari.init.in?rev=1348295&view=auto
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/package/rpm/SOURCES/ambari.init.in (added)
+++ incubator/ambari/branches/ambari-186/hmc/package/rpm/SOURCES/ambari.init.in Sat Jun  9 01:43:23 2012
@@ -0,0 +1,139 @@
+#!/bin/sh
+##
+#
+#/*
+# * 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.
+# */
+
+#
+# RPM Init file for Ambari
+#
+
+PATH=/usr/bin:/sbin:/bin:/usr/sbin
+export PATH
+
+[ -f /etc/sysconfig/puppet ] && . /etc/sysconfig/puppet
+lockfile=${LOCKFILE-/var/lock/subsys/puppet}
+pidfile=${PIDFILE-/var/run/puppet/agent.pid}
+puppetd=${PUPPETD-/usr/bin/puppet}
+RETVAL=0
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+# Determine if we can use the -p option to daemon, killproc, and status.
+# RHEL < 5 can't.
+if status | grep -q -- '-p' 2>/dev/null; then
+    daemonopts="--pidfile $pidfile"
+    pidopts="-p $pidfile"
+fi
+# copy the configs in the right config dir for puppet
+cp /etc/puppet/auth.conf /etc/puppet/master/
+cp /etc/puppet/puppet.conf /etc/puppet/master/
+
+checkHDPRepo() {
+  if [[ ! -f /etc/yum.repos.d/hdp.repo ]]; then
+    echo "Please install the HDP repo before starting Ambari"
+    exit 1
+  fi
+}
+
+bootPuppet() {
+ if [[ ! -f /var/run/hmc/puppetmaster.boot ]]; then
+   daemon  $daemonopts $puppetd  ${PUPPET_OPTS} ${PUPPET_EXTRA_OPTS}
+   killproc puppet
+   touch /var/run/hmc/puppetmaster.boot
+ fi
+}
+    
+
+checkJDK() {
+  jdk64="jdk-6u26-linux-x64.bin"
+  jdk32="jdk-6u26-linux-i586.bin"
+
+  if [[ ! -f /var/run/hmc/downloads/$jdk64 || ! -f /var/run/hmc/downloads/$jdk32 ]]; then
+    echo "Please download $jdk64 and $jdk32 from Oracle to /var/run/hmc/downloads/"
+    exit 1
+  fi
+
+  mkdir -p /var/www/html/downloads
+  cp /var/run/hmc/downloads/* /var/www/html/downloads/
+}
+
+PUPPET_OPTS="master --confdir=/etc/puppet/master --verbose --config_version=/usr/share/hmc/bin/get_revision --reports hmcreport --debug --logdest=/var/log/puppet_master.log --autoflush"
+
+case "$1" in
+    start)
+      checkHDPRepo
+      checkJDK
+      bootPuppet
+      echo "Starting Ambari Installer "
+      /etc/init.d/httpd start
+      RETVAL=$?
+	  if [ $RETVAL = 0 ]; then
+	    echo -n "Starting Ambari"
+	  else
+	    echo -n "Failed to start Ambari"
+	  fi
+	  echo 
+	  ;;
+    stop)
+	  echo "Shutting down Ambari"
+      /etc/init.d/httpd stop
+	  RETVAL=$?
+      if [ $RETVAL = 0 ]; then
+        echo -n "Stopped Ambari"
+      else
+       echo -n "Failed to stop Ambari"
+      fi
+      echo 
+	  ;;
+    try-restart|condrestart)
+	  if test "$1" = "condrestart"; then
+		echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
+	  fi
+	  $0 status
+	  if test $? = 0; then
+		$0 restart
+	  else
+	    : # Not running is not a failure.
+	  fi
+	  ;;
+    restart)
+	  $0 stop
+	  $0 start
+	  ;;
+    force-reload)
+	  echo -n "Reload service Ambari"
+	  $0 try-restart
+	  ;;
+    reload)
+      $0 restart
+	  ;;
+    status)
+      status httpd
+	  RETVAL=$?
+	  ;;
+    probe)
+      echo "Not Implemented"
+	  ;;
+    *)
+	  echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
+	  exit 1
+	  ;;
+esac
+exit $RETVAL

Modified: incubator/ambari/branches/ambari-186/hmc/package/rpm/SPECS/hmc.spec
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/package/rpm/SPECS/hmc.spec?rev=1348295&r1=1348294&r2=1348295&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/package/rpm/SPECS/hmc.spec (original)
+++ incubator/ambari/branches/ambari-186/hmc/package/rpm/SPECS/hmc.spec Sat Jun  9 01:43:23 2012
@@ -19,11 +19,11 @@
 # */
 
 #
-# RPM Spec file for HMC
+# RPM Spec file for Ambari
 #
 
-Summary: HMC
-Name: hmc
+Summary: Ambari
+Name: ambari
 Version: 1.0.0
 URL: http://incubator.apache.org/projects/ambari.html
 Release: 1%{?dist}
@@ -31,8 +31,8 @@ License: Apache License, Version 2.0
 Vendor: Apache Software Foundation (ambari-dev@incubator.apache.org)
 Group: System Environment/Base
 Source: %{name}-%{version}.tar.gz
-Source1: hmc.init.in
-Source3: hmc-agent.init.in
+Source1: ambari.init.in
+Source3: ambari-agent.init.in
 BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
 Requires: php >= 5, sqlite >= 3, php-pdo, php-pecl-json, httpd, puppet = 2.7.9, pdsh, httpd-devel, ruby-devel, rubygems, mod_passenger, mod_ssl
 %define web_prefixdir %{_prefix}/share/hmc
@@ -50,7 +50,7 @@ BuildArch: noarch
 This package provides a Management Console for Hadoop Cluster.
 
 %package agent
-Summary: agent for hmc
+Summary: agent for Ambari
 Group:  System/Daemons
 Requires: puppet = 2.7.9 
 BuildArch: noarch