incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maha...@apache.org
Subject svn commit: r1391722 [7/9] - in /incubator/ambari/branches/AMBARI-666: ./ ambari-agent/src/main/puppet/manifestloader/ ambari-agent/src/main/puppet/modules/ ambari-agent/src/main/puppet/modules/configgenerator/manifests/ ambari-agent/src/main/puppet/mo...
Date Sat, 29 Sep 2012 01:30:33 GMT
Added: incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-pig/templates/log4j.properties.erb
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-pig/templates/log4j.properties.erb?rev=1391722&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-pig/templates/log4j.properties.erb (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-pig/templates/log4j.properties.erb Sat Sep 29 01:30:22 2012
@@ -0,0 +1,30 @@
+#
+#
+# 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.
+#
+#
+#
+
+# ***** Set root logger level to DEBUG and its only appender to A.
+log4j.logger.org.apache.pig=info, A
+
+# ***** A is set to be a ConsoleAppender.
+log4j.appender.A=org.apache.log4j.ConsoleAppender
+# ***** A uses PatternLayout.
+log4j.appender.A.layout=org.apache.log4j.PatternLayout
+log4j.appender.A.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n

Added: incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-pig/templates/pig-env.sh.erb
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-pig/templates/pig-env.sh.erb?rev=1391722&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-pig/templates/pig-env.sh.erb (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-pig/templates/pig-env.sh.erb Sat Sep 29 01:30:22 2012
@@ -0,0 +1,17 @@
+# 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.
+
+JAVA_HOME=<%=scope.function_hdp_java_home()%>
+HADOOP_HOME=${HADOOP_HOME:-<%=scope.function_hdp_template_var("::hdp::params::hadoop_home")%>}

Added: incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-pig/templates/pig.properties.erb
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-pig/templates/pig.properties.erb?rev=1391722&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-pig/templates/pig.properties.erb (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-pig/templates/pig.properties.erb Sat Sep 29 01:30:22 2012
@@ -0,0 +1,54 @@
+#
+#
+# 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.
+#
+#
+#
+
+# Pig configuration file. All values can be overwritten by command line arguments.
+
+# log4jconf log4j configuration file
+# log4jconf=./conf/log4j.properties
+
+# a file that contains pig script
+#file=
+
+# load jarfile, colon separated
+#jar=
+
+#verbose print all log messages to screen (default to print only INFO and above to screen)
+#verbose=true
+
+#exectype local|mapreduce, mapreduce is default
+#exectype=local
+
+#pig.logfile=
+
+#Do not spill temp files smaller than this size (bytes)
+#pig.spill.size.threshold=5000000
+#EXPERIMENT: Activate garbage collection when spilling a file bigger than this size (bytes)
+#This should help reduce the number of files being spilled.
+#pig.spill.gc.activation.size=40000000
+
+#the following two parameters are to help estimate the reducer number
+#pig.exec.reducers.bytes.per.reducer=1000000000
+#pig.exec.reducers.max=999
+
+#Use this option only when your Pig job will otherwise die because of
+#using more counter than hadoop configured limit
+#pig.disable.counter=true

Added: incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-sqoop/manifests/init.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-sqoop/manifests/init.pp?rev=1391722&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-sqoop/manifests/init.pp (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-sqoop/manifests/init.pp Sat Sep 29 01:30:22 2012
@@ -0,0 +1,79 @@
+#
+#
+# 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.
+#
+#
+class hdp-sqoop(
+  $service_state = $hdp::params::cluster_client_state
+) inherits hdp-sqoop::params
+{
+  if ($hdp::params::use_32_bits_on_slaves == false) {
+    $size = 64
+  } else {
+    $size = 32
+  }
+
+  if ($service_state == 'no_op') {
+  } elsif ($service_state == 'uninstalled') {
+    hdp::package { 'sqoop' :
+      ensure => 'uninstalled',
+      size   => $size
+    }
+  } elsif ($service_state == 'installed_and_configured') {
+
+    hdp::package { 'sqoop' :
+      size => $size
+    }
+    class { 'hdp-sqoop::mysql-connector': }
+    if ($package_type == 'hdp') {
+      hdp-sqoop::createsymlinks { ['/usr/lib/sqoop/conf']:}
+    }
+
+    hdp-sqoop::configfile { ['sqoop-env.sh']:}
+
+    anchor { 'hdp-sqoop::begin': } -> Hdp::Package['sqoop'] -> Class['hdp-sqoop::mysql-connector'] -> Hdp-sqoop::Configfile<||> -> anchor { 'hdp-sqoop::end': }
+ } else {
+    hdp_fail("TODO not implemented yet: service_state = ${service_state}")
+  }
+}
+
+
+define hdp-sqoop::createsymlinks()
+{
+  file { '/usr/lib/sqoop/conf' :
+    #ensure => directory,
+    ensure => link,
+    target => "/etc/sqoop"
+  }
+
+  file { '/etc/default/hadoop' :
+    ensure => link,
+    target => "/usr/bin/hadoop"
+  }
+}
+
+### config files
+define hdp-sqoop::configfile()
+{
+  hdp::configfile { "${hdp::params::sqoop_conf_dir}/${name}":
+    component => 'sqoop'
+  }
+}
+
+
+

Added: incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-sqoop/manifests/mysql-connector.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-sqoop/manifests/mysql-connector.pp?rev=1391722&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-sqoop/manifests/mysql-connector.pp (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-sqoop/manifests/mysql-connector.pp Sat Sep 29 01:30:22 2012
@@ -0,0 +1,47 @@
+#
+#
+# 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.
+#
+#
+class hdp-sqoop::mysql-connector()
+{
+  include hdp-sqoop::params
+  include hdp-hive::params
+
+  $target = "${hdp::params::artifact_dir}/${zip_name}"
+  $sqoop_lib = $hdp-sqoop::params::sqoop_lib
+
+  anchor { 'hdp-sqoop::mysql-connector::begin':}
+
+   hdp::exec { 'yum install -y mysql-connector-java':
+       command => "yum install -y mysql-connector-java",
+       unless  => "rpm -qa | grep mysql-connector-java",
+       path    => ["/bin","/usr/bin/"],
+       require   => Anchor['hdp-sqoop::mysql-connector::begin']
+   }
+
+   file { "${sqoop_lib}/mysql-connector-java.jar" :
+       ensure => link,
+       target => "/usr/share/java/mysql-connector-java.jar",
+       require => Hdp::Exec['yum install -y mysql-connector-java'],
+       notify  =>  Anchor['hdp-sqoop::mysql-connector::end'],
+   }
+
+   anchor { 'hdp-sqoop::mysql-connector::end':}
+  
+}

Added: incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-sqoop/manifests/params.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-sqoop/manifests/params.pp?rev=1391722&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-sqoop/manifests/params.pp (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-sqoop/manifests/params.pp Sat Sep 29 01:30:22 2012
@@ -0,0 +1,30 @@
+#
+#
+# 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.
+#
+#
+class hdp-sqoop::params() inherits hdp::params
+{
+  $conf_dir = $hdp::params::sqoop_conf_dir
+
+  $hbase_home = hdp_default("hbase_home","/usr")
+  $hive_home = hdp_default("hive_home","/usr")
+  $zoo_conf_dir = $hdp::params::zk_conf_dir 
+  $sqoop_lib = hdp_default("sqoop_lib","/usr/lib/sqoop/lib/") #TODO: should I remove and just use sqoop_dbroot
+  $keytab_path = hdp_default("keytab_path","/etc/security/keytabs")
+}

Added: incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-sqoop/manifests/sqoop/service_check.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-sqoop/manifests/sqoop/service_check.pp?rev=1391722&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-sqoop/manifests/sqoop/service_check.pp (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-sqoop/manifests/sqoop/service_check.pp Sat Sep 29 01:30:22 2012
@@ -0,0 +1,50 @@
+#
+#
+# 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.
+#
+#
+class hdp-sqoop::sqoop::service_check() 
+{
+  include hdp-sqoop::params
+  $smoke_test_user = $hdp::params::smokeuser
+
+  # TODO:SUHAS Move this to hdp::params
+  $security_enabled=$hdp::params::security_enabled
+  $smoke_user_keytab = "${hdp-sqoop::params::keytab_path}/${smoke_test_user}.headless.keytab"
+  if ($security_enabled == true) {
+    $smoke_user_kinitcmd="/usr/kerberos/bin/kinit  -kt ${smoke_user_keytab} ${smoke_test_user}; "
+  } else {
+    $smoke_user_kinitcmd=""
+  }
+
+  $cmd = "${smoke_user_kinitcmd}su - ${smoke_test_user} -c 'sqoop version'"
+  
+  anchor { 'hdp-sqoop::sqoop::service_check::begin':}
+
+  exec { 'sqoop_smoke':
+    command   => $cmd,
+    tries     => 3,
+    try_sleep => 5,
+    path      => '/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin',
+    logoutput => "true",
+    require   => Anchor['hdp-sqoop::sqoop::service_check::begin'],
+    before    => Anchor['hdp-sqoop::sqoop::service_check::end']
+  }
+
+  anchor{ 'hdp-sqoop::sqoop::service_check::end':}
+}

Added: incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-sqoop/templates/sqoop-env.sh.erb
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-sqoop/templates/sqoop-env.sh.erb?rev=1391722&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-sqoop/templates/sqoop-env.sh.erb (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-sqoop/templates/sqoop-env.sh.erb Sat Sep 29 01:30:22 2012
@@ -0,0 +1,32 @@
+# 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.
+
+# included in all the hadoop scripts with source command
+# should not be executable directly
+# also should not be passed any arguments, since we need original $*
+
+# Set Hadoop-specific environment variables here.
+
+#Set path to where bin/hadoop is available
+export HADOOP_HOME=${HADOOP_HOME:-<%=scope.function_hdp_template_var("::hdp::params::hadoop_home")%>}
+
+#set the path to where bin/hbase is available
+export HBASE_HOME=${HBASE_HOME:-<%=scope.function_hdp_template_var("hbase_home")%>}
+
+#Set the path to where bin/hive is available
+export HIVE_HOME=${HIVE_HOME:-<%=scope.function_hdp_template_var("hive_home")%>}
+
+#Set the path for where zookeper config dir is
+export ZOOCFGDIR=${ZOOCFGDIR:-<%=scope.function_hdp_template_var("zoo_conf_dir")%>}

Added: incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/files/templetonSmoke.sh
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/files/templetonSmoke.sh?rev=1391722&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/files/templetonSmoke.sh (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/files/templetonSmoke.sh Sat Sep 29 01:30:22 2012
@@ -0,0 +1,94 @@
+#!/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.
+#
+#
+
+export ttonhost=$1
+export smoke_test_user=$2
+export smoke_user_keytab=$3
+export security_enabled=$4
+export ttonurl="http://${ttonhost}:50111/templeton/v1"
+
+if [[ $security_enabled == "true" ]]; then
+  kinitcmd="/usr/kerberos/bin/kinit  -kt ${smoke_user_keytab} ${smoke_test_user}; "
+else
+  kinitcmd=""
+fi
+
+cmd="${kinitcmd}curl --negotiate -u : -s -w 'http_code <%{http_code}>'    $ttonurl/status 2>&1"
+retVal=`su - ${smoke_test_user} -c "$cmd"`
+httpExitCode=`echo $retVal |sed 's/.*http_code <\([0-9]*\)>.*/\1/'`
+
+if [[ "$httpExitCode" -ne "200" ]] ; then
+  echo "Templeton Smoke Test (status cmd): Failed. : $retVal"
+  export TEMPLETON_EXIT_CODE=1
+  exit 1
+fi
+
+exit 0
+
+#try hcat ddl command
+echo "user.name=${smoke_test_user}&exec=show databases;" /tmp/show_db.post.txt
+cmd="${kinitcmd}curl --negotiate -u : -s -w 'http_code <%{http_code}>' -d  \@${destdir}/show_db.post.txt  $ttonurl/ddl 2>&1"
+retVal=`su - ${smoke_test_user} -c "$cmd"`
+httpExitCode=`echo $retVal |sed 's/.*http_code <\([0-9]*\)>.*/\1/'`
+
+if [[ "$httpExitCode" -ne "200" ]] ; then
+  echo "Templeton Smoke Test (ddl cmd): Failed. : $retVal"
+  export TEMPLETON_EXIT_CODE=1
+  exit  1
+fi
+
+# NOT SURE?? SUHAS
+if [[ $security_enabled == "true" ]]; then
+  echo "Templeton Pig Smoke Tests not run in secure mode"
+  exit 0
+fi
+
+#try pig query
+outname=${smoke_test_user}.`date +"%M%d%y"`.$$;
+ttonTestOutput="/tmp/idtest.${outname}.out";
+ttonTestInput="/tmp/idtest.${outname}.in";
+ttonTestScript="idtest.${outname}.pig"
+
+echo "A = load '$ttonTestInput' using PigStorage(':');"  > /tmp/$ttonTestScript
+echo "B = foreach A generate \$0 as id; " >> /tmp/$ttonTestScript
+echo "store B into '$ttonTestOutput';" >> /tmp/$ttonTestScript
+
+#copy pig script to hdfs
+su - ${smoke_test_user} -c "hadoop dfs -copyFromLocal /tmp/$ttonTestScript /tmp/$ttonTestScript"
+
+#copy input file to hdfs
+su - ${smoke_test_user} -c "hadoop dfs -copyFromLocal /etc/passwd $ttonTestInput"
+
+#create, copy post args file
+echo -n "user.name=${smoke_test_user}&file=/tmp/$ttonTestScript" > /tmp/pig_post.txt
+
+#submit pig query
+cmd="curl -s -w 'http_code <%{http_code}>' -d  \@${destdir}/pig_post.txt  $ttonurl/pig 2>&1"
+retVal=`su - ${smoke_test_user} -c "$cmd"`
+httpExitCode=`echo $retVal |sed 's/.*http_code <\([0-9]*\)>.*/\1/'`
+if [[ "$httpExitCode" -ne "200" ]] ; then
+  echo "Templeton Smoke Test (pig cmd): Failed. : $retVal"
+  export TEMPLETON_EXIT_CODE=1
+  exit 1
+fi
+
+exit 0

Added: incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/client.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/client.pp?rev=1391722&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/client.pp (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/client.pp Sat Sep 29 01:30:22 2012
@@ -0,0 +1,40 @@
+#
+#
+# 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.
+#
+#
+class hdp-templeton::client(
+  $service_state = $hdp::params::cluster_client_state,
+  $templeton_server = undef
+) inherits hdp::params
+{ 
+  if ($service_state == 'no_op') {
+   } elsif ($service_state in ['installed_and_configured','uninstalled']) {
+     if ($hdp::params::service_exists['hdp-templeton::server'] != true) {
+       #installs package, creates user, sets configuration
+       class { 'hdp-templeton' :
+         service_state => $service_state
+       }
+      if ($templeton_server != undef) {
+        Hdp-Templeton::Configfile<||>{templeton_server => $templeton_server}
+      }
+    }
+  } else {
+    hdp_fail("TODO not implemented yet: service_state = ${service_state}")
+  }
+}

Added: incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/download-hive-tar.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/download-hive-tar.pp?rev=1391722&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/download-hive-tar.pp (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/download-hive-tar.pp Sat Sep 29 01:30:22 2012
@@ -0,0 +1,46 @@
+#
+#
+# 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.
+#
+#
+class hdp-templeton::download-hive-tar()
+{
+  include hdp-templeton::params
+
+  $src_tar_name = $hdp-templeton::params::src_hive_tar_name
+  $dest_tar_name = $hdp-templeton::params::dest_hive_tar_name
+  $target = "${hdp::params::artifact_dir}/${dest_tar_name}"
+ 
+  anchor { 'hdp-templeton::download-hive-tar::begin':}         
+
+   hdp::package { 'templeton-tar-hive' :
+     require   => Anchor['hdp-templeton::download-hive-tar::begin']                                                              
+   }
+  
+   hdp::exec { 'hive mkdir -p ${artifact_dir} ;  cp /tmp/HDP-templeton/${src_tar_name} ${target}':
+       command => "mkdir -p ${artifact_dir} ;  cp /tmp/HDP-templeton/${src_tar_name} ${target}",
+       unless  => "test -f ${target}",
+       creates => $target,
+       path    => ["/bin","/usr/bin/"],
+       require => Hdp::Package['templeton-tar-hive'],
+       notify  =>  Anchor['hdp-templeton::download-hive-tar::end'],
+   }
+
+   anchor { 'hdp-templeton::download-hive-tar::end':}       
+
+}

Added: incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/download-pig-tar.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/download-pig-tar.pp?rev=1391722&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/download-pig-tar.pp (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/download-pig-tar.pp Sat Sep 29 01:30:22 2012
@@ -0,0 +1,46 @@
+#
+#
+# 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.
+#
+#
+class hdp-templeton::download-pig-tar()
+{
+  include hdp-templeton::params
+
+  $src_tar_name = $hdp-templeton::params::src_pig_tar_name
+  $dest_tar_name = $hdp-templeton::params::dest_pig_tar_name
+  $target = "${hdp::params::artifact_dir}/${dest_tar_name}"
+
+  anchor { 'hdp-templeton::download-pig-tar::begin':}
+
+   hdp::package { 'templeton-tar-pig' :
+     require   => Anchor['hdp-templeton::download-pig-tar::begin']
+   }
+
+   hdp::exec { 'pig ; mkdir -p ${artifact_dir} ;  cp /tmp/HDP-templeton/${src_tar_name} ${target}':
+       command => "mkdir -p ${artifact_dir} ;  cp /tmp/HDP-templeton/${src_tar_name} ${target}",
+       unless  => "test -f ${target}",
+       creates => $target,
+       path    => ["/bin","/usr/bin/"],
+       require => Hdp::Package['templeton-tar-pig'],
+       notify  =>  Anchor['hdp-templeton::download-pig-tar::end'],
+   }
+
+   anchor { 'hdp-templeton::download-pig-tar::end':}
+
+}

Added: incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/init.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/init.pp?rev=1391722&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/init.pp (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/init.pp Sat Sep 29 01:30:22 2012
@@ -0,0 +1,91 @@
+#
+#
+# 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.
+#
+#
+class hdp-templeton(
+  $service_state = undef,
+  $server = false
+)
+{
+  include manifestloader
+  
+  configgenerator::configfile{'templeton-site.xml: 
+    module => 'hdp-templeton',
+    properties => $manifestloader::hdp_templeton_templeton_site_props
+  }
+
+ include hdp-templeton::params 
+ 
+  if ($hdp::params::use_32_bits_on_slaves == false) {
+    $size = 64
+  } else {
+    $size = 32
+  }
+
+  $templeton_user = $hdp-templeton::params::templeton_user
+  $templeton_config_dir = $hdp-templeton::params::conf_dir
+
+  if ($service_state == 'uninstalled') {
+      hdp::package { 'templeton' :
+      size => $size,
+      ensure => 'uninstalled'
+    }
+      hdp::directory { $templeton_config_dir:
+        service_state => $service_state,
+        force => true
+      }
+
+     anchor { 'hdp-templeton::begin': } -> Hdp::Package['templeton'] -> Hdp::Directory[$templeton_config_dir] ->  anchor { 'hdp-templeton::end': }
+
+  } else {
+    hdp::package { 'templeton' :
+      size => $size
+    }
+    class { hdp-templeton::download-hive-tar: }
+    class { hdp-templeton::download-pig-tar: }
+
+    hdp::user{ $templeton_user:}
+
+    hdp::directory { $templeton_config_dir: 
+      service_state => $service_state,
+      force => true
+    }
+
+    hdp-templeton::configfile { ['templeton-site.xml','templeton-env.sh']: }
+
+    anchor { 'hdp-templeton::begin': } -> Hdp::Package['templeton'] -> Hdp::User[$templeton_user] -> Hdp::Directory[$templeton_config_dir] -> Hdp-templeton::Configfile<||> ->  anchor { 'hdp-templeton::end': }
+
+     if ($server == true ) { 
+      Hdp::Package['templeton'] -> Hdp::User[$templeton_user] ->   Class['hdp-templeton::download-hive-tar'] -> Class['hdp-templeton::download-pig-tar'] -> Anchor['hdp-templeton::end']
+     }
+  }
+}
+
+### config files
+define hdp-templeton::configfile(
+  $mode = undef
+) 
+{
+  hdp::configfile { "${hdp-templeton::params::conf_dir}/${name}":
+    component       => 'templeton',
+    owner           => $hdp-templeton::params::templeton_user,
+    mode            => $mode
+  }
+}
+

Added: incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/params.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/params.pp?rev=1391722&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/params.pp (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/params.pp Sat Sep 29 01:30:22 2012
@@ -0,0 +1,61 @@
+#
+#
+# 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.
+#
+#
+class hdp-templeton::params() inherits hdp::params
+{
+  $templeton_user = $hdp::params::templeton_user
+
+  ###pig and hive tar url connector
+  $download_url = $hdp::params::apache_artifacts_download_url
+
+  $dest_pig_tar_name = hdp_default("dest_pig_tar_name","pig.tar.gz")
+  $dest_hive_tar_name = hdp_default("dest_hive_tar_name","hive.tar.gz")
+  $src_pig_tar_name = hdp_default("src_pig_tar_name","pig-0.9.2.14.tar.gz")
+  $src_hive_tar_name = hdp_default("src_hive_tar_name","hive-0.9.0.14.tar.gz")
+
+  ### templeton-env
+  $conf_dir = hdp_default("hadoop/templeton-env/conf_dir","/etc/templeton")
+
+  ### templeton-env
+  $templeton_log_dir = hdp_default("hadoop/templeton-env/templeton_log_dir","/var/log/templeton")
+
+  $templeton_pid_dir = hdp_default("hadoop/templeton-env/templeton_pid_dir","/var/run/templeton")
+
+  $templeton_jar_name= hdp_default("hadoop/templeton-env/templeton_jar_name","templeton-0.1.4.14.jar")
+ 
+  $hadoop_prefix = hdp_default("hadoop/templeton-env/hadoop_prefix","/usr")
+  $hive_prefix = hdp_default("hadoop/templeton-env/hive_prefix","/usr")
+  
+  ### templeton-site
+  $hadoop_conf_dir = hdp_default("hadoop/templeton-site/hadoop_conf_dir")
+  $templeton_jar = hdp_default("hadoop/templeton-site/templeton_jar","/usr/share/templeton/templeton-0.1.4.14.jar")
+  $zookeeper_jar = hdp_default("hadoop/templeton-site/zookeeper_jar","/usr/lib/zookeeper/zookeeper.jar")
+  $pig_tar_gz = hdp_default("hadoop/templeton-site/pig_tar_gz","$dest_pig_tar_name")
+  $pig_tar_name_hdfs = hdp_default("hadoop/templeton-site/pig_tar_name_hdfs","pig-0.9.2.14")
+
+  $hive_tar_gz = hdp_default("hadoop/templeton-site/hive_tar_gz","$dest_hive_tar_name")
+  $hive_tar_gz_name = hdp_default("hadoop/templeton-site/hive_tar_gz_name","hive-0.9.0.14")
+  $hive_metastore_sasl_enabled = hdp_default("hadoop/templeton-site/hive_metastore_sasl_enabled","no")
+
+  $templeton_metastore_principal = hdp_default("hadoop/templeton-site/templeton_metastore_principal")
+
+  $keytab_path = hdp_default("hadoop/templeton-site/keytab_path")
+  
+}

Added: incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/server.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/server.pp?rev=1391722&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/server.pp (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/server.pp Sat Sep 29 01:30:22 2012
@@ -0,0 +1,107 @@
+#
+#
+# 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.
+#
+#
+class hdp-templeton::server(
+  $service_state = $hdp::params::cluster_service_state,
+  $opts = {}
+) inherits  hdp-templeton::params
+{  
+
+  if ($service_state == 'no_op') { 
+  } elsif ($service_state in ['running','stopped','installed_and_configured','uninstalled']) {
+  $hdp::params::service_exists['hdp-templeton::server'] = true
+
+  if ( ($service_state == 'installed_and_configured') and
+       ($security_enabled == true) and ($kerberos_install_type == "AMBARI_SET_KERBEROS") ) {
+     $masterHost = $kerberos_adminclient_host[0]
+     hdp::download_keytab { 'templeton_headless_keytab' :
+       masterhost => $masterHost,
+       keytabdst => "${$keytab_path}/templeton.headless.keytab",
+       keytabfile => 'templeton.headless.keytab',
+       owner => $hdp::params::templeton_user,
+       hostnameInPrincipals => 'no' 
+     }
+
+     if ( ($hdp::params::service_exists['hdp-hadoop::namenode'] != true) and
+          ($hdp::params::service_exists['hdp-hadoop::snamenode'] != true) and
+          ($hdp::params::service_exists['hdp-oozie::server'] != true) ) {
+       hdp::download_keytab { 'templeton_spnego_service_keytab' :
+         masterhost => $masterHost,
+         keytabdst => "${$keytab_path}/spnego.service.keytab",
+         keytabfile => 'spnego.service.keytab',
+         owner => $hdp::params::templeton_user,
+         group => 'hadoop',
+         mode => '0440'
+       }
+     }
+  }
+
+  class{ 'hdp-templeton' :
+    service_state => $service_state,
+    server        => true
+  }
+
+  class { 'hdp-templeton::copy-hdfs-directories' :
+    service_state => $service_state
+  }
+
+  class { 'hdp-templeton::service' :
+    ensure       => $service_state,
+  }
+  
+  #top level does not need anchors
+  Class['hdp-templeton'] -> Class['hdp-templeton::copy-hdfs-directories'] -> Class['hdp-templeton::service']
+  } else { 
+  hdp_fail("TODO not implemented yet: service_state = ${service_state}")
+  }
+}
+
+class hdp-templeton::copy-hdfs-directories($service_state)
+{
+ $templeton_user = $hdp-templeton::params::templeton_user
+ $pig_src_tar = "$hdp::params::artifact_dir/pig.tar.gz"
+
+  hdp-hadoop::hdfs::copyfromlocal { '/usr/share/templeton/templeton*jar':
+    service_state => $service_state,
+    owner => $hdp-templeton::params::templeton_user,
+    mode  => '755',
+    dest_dir => '/apps/templeton/ugi.jar'
+  }
+  hdp-hadoop::hdfs::copyfromlocal { '/usr/lib/hadoop/contrib/streaming/hadoop-streaming*.jar':
+   service_state => $service_state,
+   owner => $hdp-templeton::params::templeton_user,
+   mode  => '755',
+   dest_dir => '/apps/templeton/hadoop-streaming.jar'
+ }
+  #TODO: Use ${hdp::params::artifact_dir}/${hdp-templeton::params::pig_tar_name} instead
+  hdp-hadoop::hdfs::copyfromlocal { '/tmp/HDP-artifacts/pig.tar.gz' :
+    service_state => $service_state,
+    owner => $hdp-templeton::params::templeton_user,
+    mode  => '755',
+    dest_dir => '/apps/templeton/pig.tar.gz'
+  }
+  #TODO: Use ${hdp::params::artifact_dir}/${hdp-templeton::params::hive_tar_name} instead
+  hdp-hadoop::hdfs::copyfromlocal { '/tmp/HDP-artifacts/hive.tar.gz' :
+    service_state => $service_state,
+    owner => $hdp-templeton::params::templeton_user,
+    mode  => '755',
+    dest_dir => '/apps/templeton/hive.tar.gz'
+  }
+}

Added: incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/service.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/service.pp?rev=1391722&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/service.pp (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/service.pp Sat Sep 29 01:30:22 2012
@@ -0,0 +1,67 @@
+#
+#
+# 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.
+#
+#
+class hdp-templeton::service(
+  $ensure,
+  $initial_wait = undef
+)
+{
+  include $hdp-templeton::params
+  
+  $user = "$hdp-templeton::params::templeton_user"
+  $hadoop_home = $hdp-templeton::params::hadoop_prefix
+  $cmd = "env HADOOP_HOME=${hadoop_home} /usr/sbin/templeton_server.sh"
+  $pid_file = "${hdp-templeton::params::templeton_pid_dir}/templeton.pid" 
+
+  if ($ensure == 'running') {
+    $daemon_cmd = "su - ${user} -c  '${cmd} start'"
+    $no_op_test = "ls ${pid_file} >/dev/null 2>&1 && ps `cat ${pid_file}` >/dev/null 2>&1"
+  } elsif ($ensure == 'stopped') {
+    $daemon_cmd = "su - ${user} -c  '${cmd} stop'"
+    $no_op_test = undef
+  } else {
+    $daemon_cmd = undef
+  }
+
+  hdp-templeton::service::directory { $hdp-templeton::params::templeton_pid_dir : }
+  hdp-templeton::service::directory { $hdp-templeton::params::templeton_log_dir : }
+
+  anchor{'hdp-templeton::service::begin':} -> Hdp-templeton::Service::Directory<||> -> anchor{'hdp-templeton::service::end':}
+  
+  if ($daemon_cmd != undef) {
+    hdp::exec { $daemon_cmd:
+      command => $daemon_cmd,
+      unless  => $no_op_test,
+      initial_wait => $initial_wait
+    }
+    Hdp-templeton::Service::Directory<||> -> Hdp::Exec[$daemon_cmd] -> Anchor['hdp-templeton::service::end']
+  }
+}
+
+define hdp-templeton::service::directory()
+{
+  hdp::directory_recursive_create { $name: 
+    owner => $hdp-templeton::params::templeton_user,
+    mode => '0755',
+    service_state => $ensure,
+    force => true
+  }
+}
+

Added: incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/templeton/service_check.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/templeton/service_check.pp?rev=1391722&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/templeton/service_check.pp (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/templeton/service_check.pp Sat Sep 29 01:30:22 2012
@@ -0,0 +1,60 @@
+#
+#
+# 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.
+#
+#
+class hdp-templeton::templeton::service_check()
+{
+  include hdp-templeton::params
+  $smoke_test_user = $hdp::params::smokeuser
+  $security_enabled=$hdp::params::security_enabled
+  if ($security_enabled == true) {
+    $security = "true"
+  } else {
+    $security = "false"
+  }
+  $smoke_user_keytab = "${hdp-templeton::params::keytab_path}/${smoke_test_user}.headless.keytab"
+
+  $templeton_host = $hdp::params::templeton_server_host
+
+  $smoke_shell_files = ['templetonSmoke.sh']
+
+  anchor { 'hdp-templeton::templeton::service_check::begin':}
+
+  hdp-templeton::smoke_shell_file { $smoke_shell_files: }
+
+  anchor{ 'hdp-templeton::templeton::service_check::end':}
+}
+
+define hdp-templeton::smoke_shell_file()
+{
+  file { '/tmp/templetonSmoke.sh':
+    ensure => present,
+    source => "puppet:///modules/hdp-templeton/templetonSmoke.sh",
+    mode => '0755'
+  }
+
+  exec { '/tmp/templetonSmoke.sh':
+    command   => "sh /tmp/templetonSmoke.sh ${templeton_host} ${smoke_test_user} ${smoke_user_keytab} ${security}",
+    tries     => 3,
+    try_sleep => 5,
+    require   => File['/tmp/templetonSmoke.sh'],
+    path      => '/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin',
+    logoutput => "true"
+  }
+}

Added: incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/templates/templeton-env.sh.erb
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/templates/templeton-env.sh.erb?rev=1391722&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/templates/templeton-env.sh.erb (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-templeton/templates/templeton-env.sh.erb Sat Sep 29 01:30:22 2012
@@ -0,0 +1,38 @@
+#
+#
+# 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.
+#
+#
+#
+
+# The file containing the running pid
+PID_FILE=<%=scope.function_hdp_template_var("templeton_pid_dir")%>/templeton.pid
+
+TEMPLETON_LOG_DIR=<%=scope.function_hdp_template_var("templeton_log_dir")%>/
+
+# The console error log
+ERROR_LOG=<%=scope.function_hdp_template_var("templeton_log_dir")%>/templeton-console-error.log
+
+# The console log
+CONSOLE_LOG=<%=scope.function_hdp_template_var("templeton_log_dir")%>/templeton-console.log
+
+TEMPLETON_JAR=<%=scope.function_hdp_template_var("templeton_jar_name")%>
+
+HADOOP_PREFIX=<%=scope.function_hdp_template_var("hadoop_prefix")%>/
+
+HCAT_PREFIX=<%=scope.function_hdp_template_var("hive_prefix")%>/

Added: incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/files/zkEnv.sh
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/files/zkEnv.sh?rev=1391722&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/files/zkEnv.sh (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/files/zkEnv.sh Sat Sep 29 01:30:22 2012
@@ -0,0 +1,96 @@
+#!/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.
+
+# This script should be sourced into other zookeeper
+# scripts to setup the env variables
+
+# We use ZOOCFGDIR if defined,
+# otherwise we use /etc/zookeeper
+# or the conf directory that is
+# a sibling of this script's directory
+if [ "x$ZOOCFGDIR" = "x" ]
+then
+    if [ -d "/etc/zookeeper" ]
+    then
+        ZOOCFGDIR="/etc/zookeeper"
+    else
+        ZOOCFGDIR="$ZOOBINDIR/../conf"
+    fi
+fi
+
+if [ "x$ZOOCFG" = "x" ]
+then
+    ZOOCFG="zoo.cfg"
+fi
+
+ZOOCFG="$ZOOCFGDIR/$ZOOCFG"
+
+if [ -e "$ZOOCFGDIR/zookeeper-env.sh" ]
+then
+    . "$ZOOCFGDIR/zookeeper-env.sh"
+fi
+
+if [ "x${ZOO_LOG_DIR}" = "x" ]
+then
+    ZOO_LOG_DIR="."
+fi
+
+if [ "x${ZOO_LOG4J_PROP}" = "x" ]
+then
+    ZOO_LOG4J_PROP="INFO,CONSOLE"
+fi
+
+#add the zoocfg dir to classpath
+CLASSPATH="$ZOOCFGDIR:$CLASSPATH"
+
+for i in "$ZOOBINDIR"/../src/java/lib/*.jar
+do
+    CLASSPATH="$i:$CLASSPATH"
+done
+
+#make it work in the release
+for i in "$ZOOBINDIR"/../lib/*.jar
+do
+    CLASSPATH="$i:$CLASSPATH"
+done
+
+#make it work in the release
+for i in "$ZOOBINDIR"/../zookeeper-*.jar
+do
+    CLASSPATH="$i:$CLASSPATH"
+done
+
+#make it work for developers
+for d in "$ZOOBINDIR"/../build/lib/*.jar
+do
+   CLASSPATH="$d:$CLASSPATH"
+done
+
+#make it work for developers
+CLASSPATH="$ZOOBINDIR/../build/classes:$CLASSPATH"
+
+case "`uname`" in
+    CYGWIN*) cygwin=true ;;
+    *) cygwin=false ;;
+esac
+
+if $cygwin
+then
+    CLASSPATH=`cygpath -wp "$CLASSPATH"`
+fi
+
+#echo "CLASSPATH=$CLASSPATH"

Added: incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/files/zkServer.sh
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/files/zkServer.sh?rev=1391722&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/files/zkServer.sh (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/files/zkServer.sh Sat Sep 29 01:30:22 2012
@@ -0,0 +1,120 @@
+#!/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.
+
+#
+# If this scripted is run out of /usr/bin or some other system bin directory
+# it should be linked to and not copied. Things like java jar files are found
+# relative to the canonical path of this script.
+#
+
+# See the following page for extensive details on setting
+# up the JVM to accept JMX remote management:
+# http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html
+# by default we allow local JMX connections
+if [ "x$JMXLOCALONLY" = "x" ]
+then
+    JMXLOCALONLY=false
+fi
+
+if [ "x$JMXDISABLE" = "x" ]
+then
+    echo "JMX enabled by default"
+    # for some reason these two options are necessary on jdk6 on Ubuntu
+    #   accord to the docs they are not necessary, but otw jconsole cannot
+    #   do a local attach
+    ZOOMAIN="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=$JMXLOCALONLY org.apache.zookeeper.server.quorum.QuorumPeerMain"
+else
+    echo "JMX disabled by user request"
+    ZOOMAIN="org.apache.zookeeper.server.quorum.QuorumPeerMain"
+fi
+
+# Only follow symlinks if readlink supports it
+if readlink -f "$0" > /dev/null 2>&1
+then
+  ZOOBIN=`readlink -f "$0"`
+else
+  ZOOBIN="$0"
+fi
+ZOOBINDIR=`dirname "$ZOOBIN"`
+
+. "$ZOOBINDIR"/zkEnv.sh
+
+if [ "x$2" != "x" ]
+then
+    ZOOCFG="$ZOOCFGDIR/$2"
+fi
+
+if $cygwin
+then
+    ZOOCFG=`cygpath -wp "$ZOOCFG"`
+    # cygwin has a "kill" in the shell itself, gets confused
+    KILL=/bin/kill
+else
+    KILL=kill
+fi
+
+echo "Using config: $ZOOCFG"
+
+ZOOPIDFILE=$(grep dataDir "$ZOOCFG" | sed -e 's/.*=//')/zookeeper_server.pid
+
+
+case $1 in
+start)
+    echo  "Starting zookeeper ... "
+    $JAVA  "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \
+    -cp "$CLASSPATH" $JVMFLAGS $ZOOMAIN "$ZOOCFG" &
+    /bin/echo -n $! > "$ZOOPIDFILE"
+    echo STARTED
+    ;;
+stop)
+    echo "Stopping zookeeper ... "
+    if [ ! -f "$ZOOPIDFILE" ]
+    then
+    echo "error: could not find file $ZOOPIDFILE"
+    exit 1
+    else
+    $KILL -9 $(cat "$ZOOPIDFILE")
+    rm "$ZOOPIDFILE"
+    echo STOPPED
+    fi
+    ;;
+upgrade)
+    shift
+    echo "upgrading the servers to 3.*"
+    java "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \
+    -cp "$CLASSPATH" $JVMFLAGS org.apache.zookeeper.server.upgrade.UpgradeMain ${@}
+    echo "Upgrading ... "
+    ;;
+restart)
+    shift
+    "$0" stop ${@}
+    sleep 3
+    "$0" start ${@}
+    ;;
+status)
+    STAT=`echo stat | nc localhost $(grep clientPort "$ZOOCFG" | sed -e 's/.*=//') 2> /dev/null| grep Mode`
+    if [ "x$STAT" = "x" ]
+    then
+        echo "Error contacting service. It is probably not running."
+    else
+        echo $STAT
+    fi
+    ;;
+*)
+    echo "Usage: $0 {start|stop|restart|status}" >&2
+
+esac

Added: incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/files/zkService.sh
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/files/zkService.sh?rev=1391722&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/files/zkService.sh (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/files/zkService.sh Sat Sep 29 01:30:22 2012
@@ -0,0 +1,26 @@
+#!/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.
+#
+#
+
+zkcli_script=$1
+user=$2
+conf_dir=$3
+su - $user -c "source $conf_dir/zookeeper-env.sh ; echo 'ls /' | $zkcli_script"

Added: incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/files/zkSmoke.sh
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/files/zkSmoke.sh?rev=1391722&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/files/zkSmoke.sh (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/files/zkSmoke.sh Sat Sep 29 01:30:22 2012
@@ -0,0 +1,54 @@
+#!/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.
+#
+#
+
+smoke_script=$1
+smoke_user=$2
+conf_dir=$3
+export ZOOKEEPER_EXIT_CODE=0
+zkhosts=` grep server  $conf_dir/zoo.cfg  | cut -f 2 -d '=' | cut -f 1 -d ':' | tr '\n' ' ' `
+zk_node1=`echo $zkhosts | tr ' ' '\n' | head -n 1`  
+echo "zk_node1=$zk_node1"
+# Delete /zk_smoketest znode if exists
+su - $smoke_user -c "source $conf_dir/zookeeper-env.sh ;  echo delete /zk_smoketest | ${smoke_script} -server $zk_node1:2181"  
+# Create /zk_smoketest znode on one zookeeper server
+su - $smoke_user -c "source $conf_dir/zookeeper-env.sh ; echo create /zk_smoketest smoke_data | ${smoke_script} -server $zk_node1:2181"
+
+for i in $zkhosts ; do
+  echo "Running test on host $i"
+  # Verify the data associated with znode across all the nodes in the zookeeper quorum
+  su - $smoke_user -c "source $conf_dir/zookeeper-env.sh ; echo 'get /zk_smoketest' | ${smoke_script} -server $i:2181"
+  su - $smoke_user -c "source $conf_dir/zookeeper-env.sh ; echo 'ls /' | ${smoke_script} -server $i:2181"
+  output=$(su - $smoke_user -c "source $conf_dir/zookeeper-env.sh ; echo 'get /zk_smoketest' | ${smoke_script} -server $i:2181")
+  echo $output | grep smoke_data
+  if [[ $? -ne 0 ]] ; then
+    echo "Data associated with znode /zk_smoketests is not consistent on host $i"
+    ((ZOOKEEPER_EXIT_CODE=$ZOOKEEPER_EXIT_CODE+1))
+  fi
+done
+
+su - $zmoke_user -c "source $conf_dir/zookeeper-env.sh ; echo 'delete /zk_smoketest' | ${smoke_script} -server $zk_node1:2181"
+if [[ "$ZOOKEEPER_EXIT_CODE" -ne "0" ]] ; then
+  echo "Zookeeper Smoke Test: Failed" 
+else
+   echo "Zookeeper Smoke Test: Passed" 
+fi
+exit $ZOOKEEPER_EXIT_CODE

Added: incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/manifests/client.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/manifests/client.pp?rev=1391722&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/manifests/client.pp (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/manifests/client.pp Sat Sep 29 01:30:22 2012
@@ -0,0 +1,47 @@
+#
+#
+# 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.
+#
+#
+class hdp-zookeeper::client(
+  $service_state = $hdp::params::cluster_client_state
+) inherits hdp::params
+{
+  $package_type = $hdp::params::packages
+
+  if ($service_state == 'no_op') {
+  } elsif  ($service_state in ['installed_and_configured','uninstalled']) {
+      if ($package_type == 'hdp') {
+        $cmd = "ln -s /usr/libexec/zkEnv.sh /usr/bin/zkEnv.sh"
+        $test = "test -e /usr/bin/zkEnv.sh"
+        hdp::exec { $cmd :
+           command => $cmd,
+           unless  => $test,
+           require => Class['hdp-zookeeper']
+        }
+      } 
+      if ($hdp::params::service_exists['hdp-zookeeper'] != true) {
+        class { 'hdp-zookeeper' : 
+         type => 'client',
+         service_state => $service_state
+        } 
+      }
+    } else {
+   hdp_fail("TODO not implemented yet: service_state = ${service_state}")
+  }
+}

Added: incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/manifests/init.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/manifests/init.pp?rev=1391722&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/manifests/init.pp (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/manifests/init.pp Sat Sep 29 01:30:22 2012
@@ -0,0 +1,121 @@
+#
+#
+# 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.
+#
+#
+class hdp-zookeeper(
+  $type = server,
+  $service_state = $hdp::params::cluster_service_state,
+  $myid = 1,
+  $opts = {}
+) inherits hdp-zookeeper::params 
+{
+
+ if ($service_state == 'no_op') {
+   if ($type == 'server') {
+     $hdp::params::service_exists['hdp-zookeeper'] = true
+  }
+ } elsif ($service_state in ['running','stopped','installed_and_configured','uninstalled']) { 
+   $zk_user = $hdp-zookeeper::params::zk_user
+   $zk_config_dir = $hdp-zookeeper::params::conf_dir
+ 
+   anchor{'hdp-zookeeper::begin':}
+   anchor{'hdp-zookeeper::end':}
+
+   if ($service_state == 'uninstalled') {
+     if ($type == 'server') {
+       $hdp::params::service_exists['hdp-zookeeper'] = true
+    }
+     hdp::package { 'zookeeper':
+       ensure => 'uninstalled'
+     }
+     hdp::directory_recursive_create { $zk_config_dir:
+       service_state => $service_state,
+       force => true
+     }
+
+     if ($type == 'server') {
+        class { 'hdp-zookeeper::service':
+          ensure => $service_state,
+          myid   => $myid
+        }
+       }
+
+     if ($type == 'server') {
+       Anchor['hdp-zookeeper::begin'] -> Hdp::Package['zookeeper'] -> Hdp::Directory_recursive_create[$zk_config_dir] -> Class['hdp-zookeeper::service']  -> Anchor['hdp-zookeeper::end']
+     } else {
+       Anchor['hdp-zookeeper::begin'] -> Hdp::Package['zookeeper'] -> Hdp::Directory_recursive_create[$zk_config_dir] -> Anchor['hdp-zookeeper::end']
+     }
+   } else {
+     hdp::package { 'zookeeper':}
+
+     hdp::user{ $zk_user:}
+
+     hdp::directory_recursive_create { $zk_config_dir: 
+      service_state => $service_state,
+      force => true
+     }
+
+     hdp-zookeeper::configfile { ['zoo.cfg','zookeeper-env.sh','configuration.xsl','log4j.properties']: }
+ 
+     if ($hdp::params::update_zk_shell_files == true) {
+       hdp-zookeeper::shell_file{ ['zkServer.sh','zkEnv.sh']: }
+     }
+
+     if ($type == 'server') {
+       $hdp::params::service_exists['hdp-zookeeper'] = true
+       class { 'hdp-zookeeper::service': 
+         ensure => $service_state,
+         myid   => $myid
+       }
+      }
+
+      Anchor['hdp-zookeeper::begin'] -> Hdp::Package['zookeeper'] -> Hdp::User[$zk_user] -> 
+        Hdp::Directory_recursive_create[$zk_config_dir] -> Hdp-zookeeper::Configfile<||> -> Anchor['hdp-zookeeper::end']
+      if ($type == 'server') {
+        Hdp::Directory_recursive_create[$zk_config_dir] -> Hdp-zookeeper::Configfile<||> -> Class['hdp-zookeeper::service'] -> Anchor['hdp-zookeeper::end']
+      }
+      if ($hdp::params::update_zk_shell_files == true) {
+        Hdp::Package['zookeeper'] -> Hdp-zookeeper::Shell_file<||> -> Anchor['hdp-zookeeper::end']
+      }
+    }
+  } else {
+    hdp_fail("TODO not implemented yet: service_state = ${service_state}")
+  }
+}
+
+### config files
+define hdp-zookeeper::configfile(
+  $mode = undef
+) 
+{
+  hdp::configfile { "${hdp-zookeeper::params::conf_dir}/${name}":
+    component       => 'zookeeper',
+    owner           => $hdp-zookeeper::params::zk_user,
+    mode            => $mode
+  }
+}
+
+### 
+define hdp-zookeeper::shell_file()
+{
+  file { "${hdp::params::zk_bin}/${name}":
+    source => "puppet:///modules/hdp-zookeeper/${name}", 
+    mode => '0755'
+  }
+}

Added: incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/manifests/params.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/manifests/params.pp?rev=1391722&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/manifests/params.pp (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/manifests/params.pp Sat Sep 29 01:30:22 2012
@@ -0,0 +1,38 @@
+#
+#
+# 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.
+#
+#
+class hdp-zookeeper::params() inherits hdp::params 
+{
+  $conf_dir = $hdp::params::zk_conf_dir
+
+  $zk_user = $hdp::params::zk_user
+  
+  $zk_log_dir = hdp_default("zk_log_dir","/var/log/zookeeper")
+  $zk_data_dir = hdp_default("zk_data_dir","/var/lib/zookeeper/data")
+  $zk_pid_dir = hdp_default("zk_pid_dir","/var/run/zookeeper")
+  $zk_pid_file = "${zk_pid_dir}/zookeeper_server.pid"
+
+
+  $tickTime = hdp_default("tickTime","2000")
+  $initLimit = hdp_default("initLimit","10")
+  $syncLimit = hdp_default("syncLimit","5")
+  $clientPort = hdp_default("clientPort","2181")
+
+}

Added: incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/manifests/quorum/service_check.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/manifests/quorum/service_check.pp?rev=1391722&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/manifests/quorum/service_check.pp (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/manifests/quorum/service_check.pp Sat Sep 29 01:30:22 2012
@@ -0,0 +1,54 @@
+#
+#
+# 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.
+#
+#
+class hdp-zookeeper::quorum::service_check()
+{
+  include hdp-zookeeper::params
+  $conf_dir = $hdp-zookeeper::params::conf_dir
+
+  $smoke_test_user = $hdp::params::smokeuser
+
+  $smoke_script = $hdp::params::zk_smoke_test_script
+  $quorum_smoke_shell_files = ['zkSmoke.sh']
+
+  anchor { 'hdp-zookeeper::quorum::service_check::begin':}
+
+  hdp-zookeeper::quorum_smoke_shell_file { $quorum_smoke_shell_files: }
+
+  anchor{ 'hdp-zookeeper::quorum::service_check::end':}
+}
+
+define hdp-zookeeper::quorum_smoke_shell_file()
+{
+  file { '/tmp/zkSmoke.sh':
+    ensure => present,
+    source => "puppet:///modules/hdp-zookeeper/zkSmoke.sh",
+    mode => '0755'
+  }
+
+  exec { '/tmp/zkSmoke.sh':
+    command   => "sh /tmp/zkSmoke.sh ${smoke_script} ${smoke_test_user} ${conf_dir}",
+    tries     => 3,
+    try_sleep => 5,
+    require   => File['/tmp/zkSmoke.sh'],
+    path      => '/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin',
+    logoutput => "true"
+  }
+}

Added: incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/manifests/service.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/manifests/service.pp?rev=1391722&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/manifests/service.pp (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/manifests/service.pp Sat Sep 29 01:30:22 2012
@@ -0,0 +1,97 @@
+#
+#
+# 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.
+#
+#
+class hdp-zookeeper::service(
+  $ensure = $hdp::params::cluster_service_state,
+  $myid
+)
+{
+  include $hdp-zookeeper::params
+  $user = $hdp-zookeeper::params::zk_user
+  $conf_dir = $hdp-zookeeper::params::conf_dir
+  $zk_bin = $hdp::params::zk_bin
+  $cmd = "/bin/env ZOOCFGDIR=${conf_dir} ZOOCFG=zoo.cfg ${zk_bin}/zkServer.sh"
+
+  $pid_file = $hdp-zookeeper::params::zk_pid_file  
+
+  if ($ensure == 'running') {
+    $daemon_cmd = "su - ${user} -c  'source ${conf_dir}/zookeeper-env.sh ; ${cmd} start'"
+    $no_op_test = "ls ${pid_file} >/dev/null 2>&1 && ps `cat ${pid_file}` >/dev/null 2>&1"
+    #not using $no_op_test = "su - ${user} -c  '${cmd} status'" because checks more than whether there is a service started up
+  } elsif ($ensure == 'stopped') {
+    $daemon_cmd = "su - ${user} -c  'source ${conf_dir}/zookeeper-env.sh ; ${cmd} stop'"
+    #TODO: put in no_op_test for stopped
+    $no_op_test = undef
+  } else {
+    $daemon_cmd = undef
+  }
+  hdp::directory_recursive_create { $hdp-zookeeper::params::zk_pid_dir: 
+    owner        => $user,
+    context_tag => 'zk_service',
+    service_state => $ensure,
+    force => true
+  }
+  hdp::directory_recursive_create { $hdp-zookeeper::params::zk_log_dir: 
+    owner        => $user,
+    context_tag => 'zk_service',
+    service_state => $ensure,
+    force => true
+  }
+   hdp::directory_recursive_create { $hdp-zookeeper::params::zk_data_dir: 
+    owner        => $user,
+    context_tag => 'zk_service',
+    service_state => $ensure,
+    force => true
+  }
+  
+  if ($daemon_cmd != undef) {
+    hdp::exec { $daemon_cmd:
+      command => $daemon_cmd,
+      unless  => $no_op_test,
+      initial_wait => $initial_wait
+    }
+  }
+
+  if ($ensure == 'uninstalled') {
+    anchor{'hdp-zookeeper::service::begin':} -> Hdp::Directory_recursive_create<|context_tag == 'zk_service'|> ->  anchor{'hdp-zookeeper::service::end':}
+  } else {
+    class { 'hdp-zookeeper::set_myid': myid => $myid}
+
+    anchor{'hdp-zookeeper::service::begin':} -> Hdp::Directory_recursive_create<|context_tag == 'zk_service'|> -> 
+    Class['hdp-zookeeper::set_myid'] -> anchor{'hdp-zookeeper::service::end':}
+
+    if ($daemon_cmd != undef) {
+      Class['hdp-zookeeper::set_myid'] -> Hdp::Exec[$daemon_cmd] -> Anchor['hdp-zookeeper::service::end']
+    }
+  }
+}
+
+class hdp-zookeeper::set_myid($myid)
+{
+  $create_file = "${hdp-zookeeper::params::zk_data_dir}/myid"
+  $cmd = "echo '${myid}' > ${create_file}"
+  hdp::exec{ $cmd:
+    command => $cmd,
+    creates  => $create_file
+  }
+}
+
+
+

Added: incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/manifests/zookeeper/service_check.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/manifests/zookeeper/service_check.pp?rev=1391722&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/manifests/zookeeper/service_check.pp (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/manifests/zookeeper/service_check.pp Sat Sep 29 01:30:22 2012
@@ -0,0 +1,53 @@
+#
+#
+# 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.
+#
+#
+class hdp-zookeeper::zookeeper::service_check()
+{
+  include hdp-zookeeper::params
+  $conf_dir = $hdp-zookeeper::params::conf_dir
+  $smoke_script = $hdp::params::zk_smoke_test_script
+
+  $smoke_test_user = $hdp::params::smokeuser
+  $zookeeper_smoke_shell_files = ['zkService.sh']
+
+  anchor { 'hdp-zookeeper::zookeeper::service_check::begin':}
+
+  hdp-zookeeper::zookeeper_smoke_shell_file { $zookeeper_smoke_shell_files: }
+
+  anchor{ 'hdp-zookeeper::zookeeper::service_check::end':}
+}
+
+define hdp-zookeeper::zookeeper_smoke_shell_file()
+{
+  file { '/tmp/zkService.sh':
+    ensure => present,
+    source => "puppet:///modules/hdp-zookeeper/zkService.sh",
+    mode => '0755'
+  }
+
+  exec { '/tmp/zkService.sh':
+    command   => "sh /tmp/zkService.sh ${smoke_script} ${smoke_test_user} ${conf_dir}",
+    tries     => 3,
+    try_sleep => 5,
+    require   => File['/tmp/zkService.sh'],
+    path      => '/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin',
+    logoutput => "true"
+  }
+}

Added: incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/templates/configuration.xsl.erb
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/templates/configuration.xsl.erb?rev=1391722&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/templates/configuration.xsl.erb (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/templates/configuration.xsl.erb Sat Sep 29 01:30:22 2012
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:output method="html"/>
+<xsl:template match="configuration">
+<html>
+<body>
+<table border="1">
+<tr>
+ <td>name</td>
+ <td>value</td>
+ <td>description</td>
+</tr>
+<xsl:for-each select="property">
+  <tr>
+     <td><a name="{name}"><xsl:value-of select="name"/></a></td>
+     <td><xsl:value-of select="value"/></td>
+     <td><xsl:value-of select="description"/></td>
+  </tr>
+</xsl:for-each>
+</table>
+</body>
+</html>
+</xsl:template>
+</xsl:stylesheet>

Added: incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/templates/log4j.properties.erb
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/templates/log4j.properties.erb?rev=1391722&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/templates/log4j.properties.erb (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/templates/log4j.properties.erb Sat Sep 29 01:30:22 2012
@@ -0,0 +1,71 @@
+#
+#
+# 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.
+#
+#
+#
+
+#
+# ZooKeeper Logging Configuration
+#
+
+# Format is "<default threshold> (, <appender>)+
+
+# DEFAULT: console appender only
+log4j.rootLogger=INFO, CONSOLE
+
+# Example with rolling log file
+#log4j.rootLogger=DEBUG, CONSOLE, ROLLINGFILE
+
+# Example with rolling log file and tracing
+#log4j.rootLogger=TRACE, CONSOLE, ROLLINGFILE, TRACEFILE
+
+#
+# Log INFO level and above messages to the console
+#
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.Threshold=INFO
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} - %-5p [%t:%C{1}@%L] - %m%n
+
+#
+# Add ROLLINGFILE to rootLogger to get log file output
+#    Log DEBUG level and above messages to a log file
+log4j.appender.ROLLINGFILE=org.apache.log4j.RollingFileAppender
+log4j.appender.ROLLINGFILE.Threshold=DEBUG
+log4j.appender.ROLLINGFILE.File=zookeeper.log
+
+# Max log file size of 10MB
+log4j.appender.ROLLINGFILE.MaxFileSize=10MB
+# uncomment the next line to limit number of backup files
+#log4j.appender.ROLLINGFILE.MaxBackupIndex=10
+
+log4j.appender.ROLLINGFILE.layout=org.apache.log4j.PatternLayout
+log4j.appender.ROLLINGFILE.layout.ConversionPattern=%d{ISO8601} - %-5p [%t:%C{1}@%L] - %m%n
+
+
+#
+# Add TRACEFILE to rootLogger to get log file output
+#    Log DEBUG level and above messages to a log file
+log4j.appender.TRACEFILE=org.apache.log4j.FileAppender
+log4j.appender.TRACEFILE.Threshold=TRACE
+log4j.appender.TRACEFILE.File=zookeeper_trace.log
+
+log4j.appender.TRACEFILE.layout=org.apache.log4j.PatternLayout
+### Notice we are including log4j's NDC here (%x)
+log4j.appender.TRACEFILE.layout.ConversionPattern=%d{ISO8601} - %-5p [%t:%C{1}@%L][%x] - %m%n

Added: incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/templates/zoo.cfg.erb
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/templates/zoo.cfg.erb?rev=1391722&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/templates/zoo.cfg.erb (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/templates/zoo.cfg.erb Sat Sep 29 01:30:22 2012
@@ -0,0 +1,37 @@
+#
+#
+# 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.
+#
+#
+#
+
+# The number of milliseconds of each tick
+tickTime=<%=scope.function_hdp_template_var("tickTime")%>
+# The number of ticks that the initial
+# synchronization phase can take
+initLimit=<%=scope.function_hdp_template_var("initLimit")%>
+# The number of ticks that can pass between
+# sending a request and getting an acknowledgement
+syncLimit=<%=scope.function_hdp_template_var("syncLimit")%>
+# the directory where the snapshot is stored.
+dataDir=<%=scope.function_hdp_template_var("zk_data_dir")%>
+# the port at which the clients will connect
+clientPort=<%=scope.function_hdp_template_var("clientPort")%>
+<%(scope.function_hdp_host("zookeeper_hosts")||[]).each_with_index do |host,i|-%>
+server.<%=(i+1).to_s%>=<%=host%>:2888:3888
+<% end -%>

Added: incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/templates/zookeeper-env.sh.erb
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/templates/zookeeper-env.sh.erb?rev=1391722&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/templates/zookeeper-env.sh.erb (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp-zookeeper/templates/zookeeper-env.sh.erb Sat Sep 29 01:30:22 2012
@@ -0,0 +1,20 @@
+# 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 JAVA_HOME=<%=scope.function_hdp_java_home()%>
+export ZOO_LOG_DIR=<%=scope.function_hdp_template_var("zk_log_dir")%>
+export ZOOPIDFILE=<%=scope.function_hdp_template_var("zk_pid_file")%>
+export SERVER_JVMFLAGS= 
+export JAVA=$JAVA_HOME/bin/java
+export CLASSPATH=$CLASSPATH:/usr/share/zookeeper/*
\ No newline at end of file

Added: incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp/lib/puppet/parser/functions/hdp_args_as_array.rb
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp/lib/puppet/parser/functions/hdp_args_as_array.rb?rev=1391722&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp/lib/puppet/parser/functions/hdp_args_as_array.rb (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-agent/src/main/puppet/modules/hdp/lib/puppet/parser/functions/hdp_args_as_array.rb Sat Sep 29 01:30:22 2012
@@ -0,0 +1,26 @@
+#
+#
+# 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.
+#
+#
+#to handle differences in how args passed in
+module Puppet::Parser::Functions
+  newfunction(:hdp_args_as_array, :type => :rvalue) do |args|
+    args.kind_of?(Array) ? args : [args]
+  end
+end



Mime
View raw message