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/07 02:32:46 UTC

svn commit: r1347217 - in /incubator/ambari/branches/ambari-186: CHANGES.txt hmc/ShellScripts/puppet_agent_install.sh hmc/package/rpm/SOURCES/hmc_hdp.repo hmc/package/rpm/SPECS/hmc.spec hmc/package/rpm/create_hmc_rpm.sh

Author: vikram
Date: Thu Jun  7 00:32:45 2012
New Revision: 1347217

URL: http://svn.apache.org/viewvc?rev=1347217&view=rev
Log:
AMBARI-414. Add rpm spec for hmc agent.  (Contributed by Mahadev)

Modified:
    incubator/ambari/branches/ambari-186/CHANGES.txt
    incubator/ambari/branches/ambari-186/hmc/ShellScripts/puppet_agent_install.sh
    incubator/ambari/branches/ambari-186/hmc/package/rpm/SOURCES/hmc_hdp.repo
    incubator/ambari/branches/ambari-186/hmc/package/rpm/SPECS/hmc.spec
    incubator/ambari/branches/ambari-186/hmc/package/rpm/create_hmc_rpm.sh

Modified: incubator/ambari/branches/ambari-186/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/CHANGES.txt?rev=1347217&r1=1347216&r2=1347217&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/CHANGES.txt (original)
+++ incubator/ambari/branches/ambari-186/CHANGES.txt Thu Jun  7 00:32:45 2012
@@ -6,6 +6,8 @@ characters wide.
 
 Release 0.1.x - unreleased
 
+  AMBARI-414. Add rpm spec for hmc agent. (Mahadev via Vikram)
+
   AMBARI-409. Uninstall does not get full list of hosts. (Vikram)
 
   AMBARI-410. Need to move the creation of cluster directory for hosting the key file and the nodes file to add nodes. (Vikram)

Modified: incubator/ambari/branches/ambari-186/hmc/ShellScripts/puppet_agent_install.sh
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/ShellScripts/puppet_agent_install.sh?rev=1347217&r1=1347216&r2=1347217&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/ShellScripts/puppet_agent_install.sh (original)
+++ incubator/ambari/branches/ambari-186/hmc/ShellScripts/puppet_agent_install.sh Thu Jun  7 00:32:45 2012
@@ -139,7 +139,7 @@ host=`hostname -f | tr '[:upper:]' '[:lo
 out=`/etc/init.d/iptables stop 1>/dev/null`
 
 echo "Installing puppet using yum"
-out=`yum install -y puppet-2.7.9-2`
+out=`yum install -y hmc-agent`
 ret=$?
 if [[ "$ret" != "0" ]]; then
   echo "$host:_ERROR_:retcode:[$ret], CMD:[$pp_cmd]: OUT:[$out]" >&2
@@ -153,7 +153,7 @@ if [[ "$ret" != "0" ]]; then
   echo "$host:_ERROR_:retcode:[$ret], CMD:[$pp_cmd]: OUT:[$out]" >&2
   exit 1
 fi
-
+out=`echo $master > /etc/hmc/hmc-agent.conf`
 out=`mkdir -p /etc/puppet/agent 2>&1`
 agent_auth_conf="path /run\nauth any\nallow $master\n\npath /\nauth any"
 out=`echo -e $agent_auth_conf > /etc/puppet/agent/auth.conf`
@@ -168,14 +168,21 @@ fi
 
 #TODO clean this up for better fix. For now make sure we stop puppet agent. The issue here is we do not know if we started this puppet agent during our run or not.
 echo "Stopping puppet agent using service stop command"
-out=`service puppet stop`
+out=`service hmc-agent stop`
 ret=$?
 
 echo "Starting puppet agent for HMC"
-out=`puppet agent --verbose --confdir=/etc/puppet/agent --listen --runinterval 5 --server $master --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 2>&1`
+out=`service hmc-agent start`
 ret=$?
 if [[ "$ret" != "0" ]]; then
   echo "$host:_ERROR_:retcode:[$ret], CMD:[$pp_cmd]: OUT:[$out]" >&2
   exit 1
 fi
+echo "Setting chkconfig for HMC"
+out=`chkconfig --add hmc-agent`
+ret=$?
+#if [[ "$ret" != "0" ]]; then
+#  echo "$host:_ERROR_:retcode:[$ret], CMD:[$pp_cmd]: OUT:[$out]" >&2
+#  exit 1
+#fi
 exit 0

Modified: incubator/ambari/branches/ambari-186/hmc/package/rpm/SOURCES/hmc_hdp.repo
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/package/rpm/SOURCES/hmc_hdp.repo?rev=1347217&r1=1347216&r2=1347217&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/package/rpm/SOURCES/hmc_hdp.repo (original)
+++ incubator/ambari/branches/ambari-186/hmc/package/rpm/SOURCES/hmc_hdp.repo Thu Jun  7 00:32:45 2012
@@ -7,6 +7,13 @@ enabled=1
 gpgcheck=0
 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
 
+[HDP-1.0.11]
+name=Hortonworks Data Platform Version - HDP-1.0.11
+baseurl=http://s3.amazonaws.com/temp.repo/HDP-1.0.11/repos/centos5
+gpgcheck=0
+enabled=1
+priority=1
+
 [Puppet]
 name=Puppet
 baseurl = http://yum.puppetlabs.com/el/5/products/x86_64/

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=1347217&r1=1347216&r2=1347217&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 Thu Jun  7 00:32:45 2012
@@ -33,7 +33,8 @@ Group: System Environment/Base
 Source: %{name}-%{version}.tar.gz
 Source1: hmc.init.in
 Source2: hmc_hdp.repo
-Buildroot: %{_tmppath}/%{name}-%{version}-buildroot
+Source3: hmc-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
 %define httpd_confdir %{_sysconfdir}/httpd/conf.d
@@ -42,16 +43,26 @@ Requires: php >= 5, sqlite >= 3, php-pdo
 %define hmc_db_dir %{_var}/db/hmc
 %define hmc_run_dir %{_var}/run/hmc
 %define hmc_log_dir %{_var}/log/hmc
-BuildArchitectures: noarch
+%define hmc_agent_dir %{_sysconfdir}/hmc
+BuildArch: noarch
+
 
 %description
 This package provides a Management Console for Hadoop Cluster.
 
+%package agent
+Summary: agent for hmc
+Group:  System/Daemons
+Requires: puppet = 2.7.9 
+BuildArch: noarch
+%description agent
+This package provides a Management Console for Hadoop Cluster. 
+
+
 %prep
 %setup -q -n %{name}-%{version}
 
 %build
-
 %pre
 # Make a backup of existing database before installing new package
 if [ -f /var/db/hmc/data/data.db ]; then
@@ -59,10 +70,12 @@ if [ -f /var/db/hmc/data/data.db ]; then
   mv /var/db/hmc/data/data.db /var/db/hmc/data/data.db.$DATE
 fi
 
+
 %install
 # Flush any old RPM build root
 %__rm -rf $RPM_BUILD_ROOT
 %__install -D -m0755 "%{SOURCE1}" "$RPM_BUILD_ROOT/etc/init.d/%{name}"
+%__install -D -m0755 "%{SOURCE3}" "$RPM_BUILD_ROOT/etc/init.d/%{name}-agent"
 %__mkdir -p $RPM_BUILD_ROOT/usr/lib/ruby/site_ruby/1.8/puppet/reports/
 %__mkdir -p $RPM_BUILD_ROOT/%{web_prefixdir}/
 %__mkdir -p $RPM_BUILD_ROOT/%{web_prefixdir}/bin/
@@ -97,6 +110,7 @@ fi
 %__install -D -m0755 puppet/reports/get_revision $RPM_BUILD_ROOT/%{web_prefixdir}/bin
 %__cp -rf puppet/reports/hmcreport.rb $RPM_BUILD_ROOT/usr/lib/ruby/site_ruby/1.8/puppet/reports/
 echo "Alias /hdp %{_prefix}/share/hdp" > $RPM_BUILD_ROOT/%{httpd_confdir}/hdp_mon_dashboard.conf
+ 
 
 %post
 if test X"$RPM_INSTALL_PREFIX0" = X"" ; then
@@ -122,7 +136,7 @@ host=`hostname -f | tr '[:upper:]' '[:lo
 sed -i "s/__TODO_HOSTNAME__/$host/g" /etc/httpd/conf.d/puppetmaster.conf
 cp $RPM_INSTALL_PREFIX0/share/hmc/puppet/conf/puppet.conf.template /etc/puppet/puppet.conf
 echo 0 > /selinux/enforce
-htpasswd -mbc /etc/hmc/htpasswd.users hmcadmin hmcadmin
+htpasswd -mbc /etc/hmc/htpasswd.users hmcadmin hmcadmin &> /dev/null
 #chown apache:apache /var/db/hmc/data/data.db
 chown -R puppet:apache /etc/hmc
 
@@ -145,9 +159,13 @@ rm -rf /var/run/hmc/puppetmaster.boot
 %{hmc_db_dir}
 %{hmc_log_dir}
 %{hmc_run_dir}/*
-%clean
-%__rm -rf $RPM_BUILD_ROOT
 
+%files agent
+/etc/init.d/hmc-agent
+%{hmc_agent_dir}
+
+#%clean
+#%__rm -rf $RPM_BUILD_ROOT
 %changelog
 * Wed Apr 04 2012 Hortonworks <am...@hortonworks.com>
 - Initial version

Modified: incubator/ambari/branches/ambari-186/hmc/package/rpm/create_hmc_rpm.sh
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/package/rpm/create_hmc_rpm.sh?rev=1347217&r1=1347216&r2=1347217&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/package/rpm/create_hmc_rpm.sh (original)
+++ incubator/ambari/branches/ambari-186/hmc/package/rpm/create_hmc_rpm.sh Thu Jun  7 00:32:45 2012
@@ -72,7 +72,11 @@ mkdir -p ${RPM_BUILDDIR}/SRPMS/
 
 cp -f ${BASEDIR}/SPECS/${PKG_NAME}.spec ${RPM_BUILDDIR}/SPECS/
 cp -f ${TAR_DEST} ${RPM_BUILDDIR}/SOURCES/
-cp -f ${BASEDIR}/SOURCES/* ${RPM_BUILDDIR}/SOURCES/
+cp -f ${BASEDIR}/SOURCES/${PKG_NAME}_hdp.repo ${RPM_BUILDDIR}/SOURCES/
+cp -f ${BASEDIR}/SOURCES/${PKG_NAME}.init.in ${RPM_BUILDDIR}/SOURCES/
+cp -f ${BASEDIR}/SOURCES/${PKG_NAME}-agent.init.in ${RPM_BUILDDIR}/SOURCES/
+
+
 
 cd ${RPM_BUILDDIR}
 
@@ -88,10 +92,9 @@ if [[ "$ret" != "0" ]]; then
 fi
 
 cd ${CUR_DIR}
-
 RPM_DEST=`find ${RPM_BUILDDIR}/{SRPMS,RPMS} -name *.noarch.rpm`
-if [[ ! -f "${RPM_DEST}" ]]; then
-  echo "Error: ${RPM_DEST} does not exist"
+if [[ -z "${RPM_DEST}" ]]; then
+  echo "Error: RPM_DEST dir is empty"
   exit 1
 fi