You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ma...@apache.org on 2012/10/15 07:55:57 UTC

svn commit: r1398196 [9/11] - in /incubator/ambari/branches/branch-0.9-h2-dev: ./ hmc/js/ hmc/package/rpm/ hmc/php/conf/ hmc/php/db/ hmc/php/frontend/ hmc/php/orchestrator/ hmc/php/puppet/ hmc/php/puppet/genmanifest/ hmc/php/util/ hmc/puppet/modules/hd...

Added: incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-pig/manifests/init.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-pig/manifests/init.pp?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-pig/manifests/init.pp (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-pig/manifests/init.pp Mon Oct 15 05:55:46 2012
@@ -0,0 +1,72 @@
+#
+#
+# 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 hdp2-pig(
+  $service_state = $hdp2::params::cluster_client_state
+) inherits hdp2-pig::params
+{  
+  $pig_config_dir = $hdp2-pig::params::pig_conf_dir
+ 
+  if ($hdp2::params::use_32_bits_on_slaves == false) {
+    $size = 64
+  } else {
+    $size = 32
+  }
+
+  if ($service_state == 'no_op') {
+  } elsif ($service_state == 'uninstalled') {
+    hdp2::package { 'pig' :
+      ensure => 'uninstalled',
+      size   => $size 
+    }
+    hdp2::directory_recursive_create { $pig_config_dir:
+      service_state => $service_state,
+      force => true
+    }
+   anchor { 'hdp2-pig::begin': } -> Hdp2::Package['pig'] -> Hdp2::Directory_recursive_create[$pig_conf_dir] -> anchor { 'hdp2-pig::end': }
+
+  } elsif ($service_state == 'installed_and_configured') {
+    hdp2::package { 'pig' : 
+      size => $size 
+    }
+
+    hdp2::directory { $pig_config_dir:
+      service_state => $service_state,
+      force => true
+    }
+
+    hdp2-pig::configfile { ['pig-env.sh','pig.properties','log4j.properties']:}
+  
+    anchor { 'hdp2-pig::begin': } -> Hdp2::Package['pig'] -> Hdp2::Directory[$pig_conf_dir] -> Hdp2-pig::Configfile<||> -> anchor { 'hdp2-pig::end': }
+ } else {
+    hdp_fail("TODO not implemented yet: service_state = ${service_state}")
+  }
+}
+
+### config files
+define hdp2-pig::configfile()
+{
+  hdp2::configfile { "${hdp2::params::pig_conf_dir}/${name}":
+    component => 'pig'
+  }
+}
+
+
+

Added: incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-pig/manifests/params.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-pig/manifests/params.pp?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-pig/manifests/params.pp (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-pig/manifests/params.pp Mon Oct 15 05:55:46 2012
@@ -0,0 +1,24 @@
+#
+#
+# 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 hdp2-pig::params() inherits hdp2::params
+{
+  $pig_conf_dir = $hdp2::params::pig_conf_dir
+}

Added: incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-pig/manifests/pig/service_check.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-pig/manifests/pig/service_check.pp?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-pig/manifests/pig/service_check.pp (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-pig/manifests/pig/service_check.pp Mon Oct 15 05:55:46 2012
@@ -0,0 +1,70 @@
+#
+#
+# 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 hdp2-pig::pig::service_check() 
+{
+  $smoke_test_user = $hdp2::params::smokeuser
+  $input_file = 'passwd'
+  $output_file = "pigsmoke.out"
+
+  $cleanup_cmd = "dfs -rmr ${output_file} ${input_file}"
+  #cleanup put below to handle retries; if retrying there wil be a stale file that needs cleanup; exit code is fn of second command
+  $create_file_cmd = "${cleanup_cmd}; hadoop dfs -put /etc/passwd ${input_file} " #TODO: inconsistent that second comamnd needs hadoop
+  $test_cmd = "fs -test -e ${output_file}" 
+  
+  anchor { 'hdp2-pig::pig::service_check::begin':}
+
+
+  hdp2-hadoop::exec-hadoop { 'pig::service_check::create_file':
+    command   => $create_file_cmd,
+    tries     => 3,
+    try_sleep => 5,
+    require   => Anchor['hdp2-pig::pig::service_check::begin'],
+    notify    => File['/tmp/pigSmoke.sh'],
+    user      => $smoke_test_user
+  }
+
+  file { '/tmp/pigSmoke.sh':
+    ensure => present,
+    source => "puppet:///modules/hdp2-pig/pigSmoke.sh",
+    mode => '0755',
+    require     => Hdp2-hadoop::Exec-hadoop['pig::service_check::create_file']
+  }
+
+  exec { '/tmp/pigSmoke.sh':
+    command   => "su - ${smoke_test_user} -c 'pig /tmp/pigSmoke.sh'",
+    tries     => 3,
+    try_sleep => 5,
+    require   => File['/tmp/pigSmoke.sh'],
+    path      => '/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin',
+    notify    => Hdp2-hadoop::Exec-hadoop['pig::service_check::test'],
+    logoutput => "true"
+  }
+
+  hdp2-hadoop::exec-hadoop { 'pig::service_check::test':
+    command     => $test_cmd,
+    refreshonly => true,
+    require     => Exec['/tmp/pigSmoke.sh'],
+    before      => Anchor['hdp2-pig::pig::service_check::end'], #TODO: remove after testing
+    user      => $smoke_test_user
+  }
+  
+  anchor{ 'hdp2-pig::pig::service_check::end':}
+}

Added: incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-pig/templates/log4j.properties.erb
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-pig/templates/log4j.properties.erb?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-pig/templates/log4j.properties.erb (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-pig/templates/log4j.properties.erb Mon Oct 15 05:55:46 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/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-pig/templates/pig-env.sh.erb
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-pig/templates/pig-env.sh.erb?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-pig/templates/pig-env.sh.erb (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-pig/templates/pig-env.sh.erb Mon Oct 15 05:55:46 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("::hdp2::params::hadoop_home")%>}

Added: incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-pig/templates/pig.properties.erb
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-pig/templates/pig.properties.erb?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-pig/templates/pig.properties.erb (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-pig/templates/pig.properties.erb Mon Oct 15 05:55:46 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/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/files/zkEnv.sh
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/files/zkEnv.sh?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/files/zkEnv.sh (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/files/zkEnv.sh Mon Oct 15 05:55:46 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/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/files/zkServer.sh
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/files/zkServer.sh?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/files/zkServer.sh (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/files/zkServer.sh Mon Oct 15 05:55:46 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/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/files/zkService.sh
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/files/zkService.sh?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/files/zkService.sh (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/files/zkService.sh Mon Oct 15 05:55:46 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/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/files/zkSmoke.sh
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/files/zkSmoke.sh?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/files/zkSmoke.sh (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/files/zkSmoke.sh Mon Oct 15 05:55:46 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/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/manifests/client.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/manifests/client.pp?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/manifests/client.pp (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/manifests/client.pp Mon Oct 15 05:55:46 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 hdp2-zookeeper::client(
+  $service_state = $hdp2::params::cluster_client_state
+) inherits hdp2::params
+{
+  $package_type = $hdp2::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"
+        hdp2::exec { $cmd :
+           command => $cmd,
+           unless  => $test,
+           require => Class['hdp2-zookeeper']
+        }
+      } 
+      if ($hdp2::params::service_exists['hdp2-zookeeper'] != true) {
+        class { 'hdp2-zookeeper' : 
+         type => 'client',
+         service_state => $service_state
+        } 
+      }
+    } else {
+   hdp_fail("TODO not implemented yet: service_state = ${service_state}")
+  }
+}

Added: incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/manifests/init.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/manifests/init.pp?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/manifests/init.pp (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/manifests/init.pp Mon Oct 15 05:55:46 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 hdp2-zookeeper(
+  $type = server,
+  $service_state = $hdp2::params::cluster_service_state,
+  $myid = 1,
+  $opts = {}
+) inherits hdp2-zookeeper::params 
+{
+
+ if ($service_state == 'no_op') {
+   if ($type == 'server') {
+     $hdp2::params::service_exists['hdp2-zookeeper'] = true
+  }
+ } elsif ($service_state in ['running','stopped','installed_and_configured','uninstalled']) { 
+   $zk_user = $hdp2-zookeeper::params::zk_user
+   $zk_config_dir = $hdp2-zookeeper::params::conf_dir
+ 
+   anchor{'hdp2-zookeeper::begin':}
+   anchor{'hdp2-zookeeper::end':}
+
+   if ($service_state == 'uninstalled') {
+     if ($type == 'server') {
+       $hdp2::params::service_exists['hdp2-zookeeper'] = true
+    }
+     hdp2::package { 'zookeeper':
+       ensure => 'uninstalled'
+     }
+     hdp2::directory_recursive_create { $zk_config_dir:
+       service_state => $service_state,
+       force => true
+     }
+
+     if ($type == 'server') {
+        class { 'hdp2-zookeeper::service':
+          ensure => $service_state,
+          myid   => $myid
+        }
+       }
+
+     if ($type == 'server') {
+       Anchor['hdp2-zookeeper::begin'] -> Hdp2::Package['zookeeper'] -> Hdp2::Directory_recursive_create[$zk_config_dir] -> Class['hdp2-zookeeper::service']  -> Anchor['hdp2-zookeeper::end']
+     } else {
+       Anchor['hdp2-zookeeper::begin'] -> Hdp2::Package['zookeeper'] -> Hdp2::Directory_recursive_create[$zk_config_dir] -> Anchor['hdp2-zookeeper::end']
+     }
+   } else {
+     hdp2::package { 'zookeeper':}
+
+     hdp2::user{ $zk_user:}
+
+     hdp2::directory_recursive_create { $zk_config_dir: 
+      service_state => $service_state,
+      force => true
+     }
+
+     hdp2-zookeeper::configfile { ['zoo.cfg','zookeeper-env.sh','configuration.xsl','log4j.properties']: }
+ 
+     if ($hdp2::params::update_zk_shell_files == true) {
+       hdp2-zookeeper::shell_file{ ['zkServer.sh','zkEnv.sh']: }
+     }
+
+     if ($type == 'server') {
+       $hdp2::params::service_exists['hdp2-zookeeper'] = true
+       class { 'hdp2-zookeeper::service': 
+         ensure => $service_state,
+         myid   => $myid
+       }
+      }
+
+      Anchor['hdp2-zookeeper::begin'] -> Hdp2::Package['zookeeper'] -> Hdp2::User[$zk_user] -> 
+        Hdp2::Directory_recursive_create[$zk_config_dir] -> Hdp2-zookeeper::Configfile<||> -> Anchor['hdp2-zookeeper::end']
+      if ($type == 'server') {
+        Hdp2::Directory_recursive_create[$zk_config_dir] -> Hdp2-zookeeper::Configfile<||> -> Class['hdp2-zookeeper::service'] -> Anchor['hdp2-zookeeper::end']
+      }
+      if ($hdp2::params::update_zk_shell_files == true) {
+        Hdp2::Package['zookeeper'] -> Hdp2-zookeeper::Shell_file<||> -> Anchor['hdp2-zookeeper::end']
+      }
+    }
+  } else {
+    hdp_fail("TODO not implemented yet: service_state = ${service_state}")
+  }
+}
+
+### config files
+define hdp2-zookeeper::configfile(
+  $mode = undef
+) 
+{
+  hdp2::configfile { "${hdp2-zookeeper::params::conf_dir}/${name}":
+    component       => 'zookeeper',
+    owner           => $hdp2-zookeeper::params::zk_user,
+    mode            => $mode
+  }
+}
+
+### 
+define hdp2-zookeeper::shell_file()
+{
+  file { "${hdp2::params::zk_bin}/${name}":
+    source => "puppet:///modules/hdp2-zookeeper/${name}", 
+    mode => '0755'
+  }
+}

Added: incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/manifests/params.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/manifests/params.pp?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/manifests/params.pp (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/manifests/params.pp Mon Oct 15 05:55:46 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 hdp2-zookeeper::params() inherits hdp2::params 
+{
+  $conf_dir = $hdp2::params::zk_conf_dir
+
+  $zk_user = $hdp2::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/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/manifests/quorum/service_check.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/manifests/quorum/service_check.pp?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/manifests/quorum/service_check.pp (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/manifests/quorum/service_check.pp Mon Oct 15 05:55:46 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 hdp2-zookeeper::quorum::service_check()
+{
+  include hdp2-zookeeper::params
+  $conf_dir = $hdp2-zookeeper::params::conf_dir
+
+  $smoke_test_user = $hdp2::params::smokeuser
+
+  $smoke_script = $hdp2::params::zk_smoke_test_script
+  $quorum_smoke_shell_files = ['zkSmoke.sh']
+
+  anchor { 'hdp2-zookeeper::quorum::service_check::begin':}
+
+  hdp2-zookeeper::quorum_smoke_shell_file { $quorum_smoke_shell_files: }
+
+  anchor{ 'hdp2-zookeeper::quorum::service_check::end':}
+}
+
+define hdp2-zookeeper::quorum_smoke_shell_file()
+{
+  file { '/tmp/zkSmoke.sh':
+    ensure => present,
+    source => "puppet:///modules/hdp2-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/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/manifests/service.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/manifests/service.pp?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/manifests/service.pp (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/manifests/service.pp Mon Oct 15 05:55:46 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 hdp2-zookeeper::service(
+  $ensure = $hdp2::params::cluster_service_state,
+  $myid
+)
+{
+  include $hdp2-zookeeper::params
+  $user = $hdp2-zookeeper::params::zk_user
+  $conf_dir = $hdp2-zookeeper::params::conf_dir
+  $zk_bin = $hdp2::params::zk_bin
+  $cmd = "/bin/env ZOOCFGDIR=${conf_dir} ZOOCFG=zoo.cfg ${zk_bin}/zkServer.sh"
+
+  $pid_file = $hdp2-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
+  }
+  hdp2::directory_recursive_create { $hdp2-zookeeper::params::zk_pid_dir: 
+    owner        => $user,
+    context_tag => 'zk_service',
+    service_state => $ensure,
+    force => true
+  }
+  hdp2::directory_recursive_create { $hdp2-zookeeper::params::zk_log_dir: 
+    owner        => $user,
+    context_tag => 'zk_service',
+    service_state => $ensure,
+    force => true
+  }
+   hdp2::directory_recursive_create { $hdp2-zookeeper::params::zk_data_dir: 
+    owner        => $user,
+    context_tag => 'zk_service',
+    service_state => $ensure,
+    force => true
+  }
+  
+  if ($daemon_cmd != undef) {
+    hdp2::exec { $daemon_cmd:
+      command => $daemon_cmd,
+      unless  => $no_op_test,
+      initial_wait => $initial_wait
+    }
+  }
+
+  if ($ensure == 'uninstalled') {
+    anchor{'hdp2-zookeeper::service::begin':} -> Hdp2::Directory_recursive_create<|context_tag == 'zk_service'|> ->  anchor{'hdp2-zookeeper::service::end':}
+  } else {
+    class { 'hdp2-zookeeper::set_myid': myid => $myid}
+
+    anchor{'hdp2-zookeeper::service::begin':} -> Hdp2::Directory_recursive_create<|context_tag == 'zk_service'|> -> 
+    Class['hdp2-zookeeper::set_myid'] -> anchor{'hdp2-zookeeper::service::end':}
+
+    if ($daemon_cmd != undef) {
+      Class['hdp2-zookeeper::set_myid'] -> Hdp2::Exec[$daemon_cmd] -> Anchor['hdp2-zookeeper::service::end']
+    }
+  }
+}
+
+class hdp2-zookeeper::set_myid($myid)
+{
+  $create_file = "${hdp2-zookeeper::params::zk_data_dir}/myid"
+  $cmd = "echo '${myid}' > ${create_file}"
+  hdp2::exec{ $cmd:
+    command => $cmd,
+    creates  => $create_file
+  }
+}
+
+
+

Added: incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/manifests/zookeeper/service_check.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/manifests/zookeeper/service_check.pp?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/manifests/zookeeper/service_check.pp (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/manifests/zookeeper/service_check.pp Mon Oct 15 05:55:46 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 hdp2-zookeeper::zookeeper::service_check()
+{
+  include hdp2-zookeeper::params
+  $conf_dir = $hdp2-zookeeper::params::conf_dir
+  $smoke_script = $hdp2::params::zk_smoke_test_script
+
+  $smoke_test_user = $hdp2::params::smokeuser
+  $zookeeper_smoke_shell_files = ['zkService.sh']
+
+  anchor { 'hdp2-zookeeper::zookeeper::service_check::begin':}
+
+  hdp2-zookeeper::zookeeper_smoke_shell_file { $zookeeper_smoke_shell_files: }
+
+  anchor{ 'hdp2-zookeeper::zookeeper::service_check::end':}
+}
+
+define hdp2-zookeeper::zookeeper_smoke_shell_file()
+{
+  file { '/tmp/zkService.sh':
+    ensure => present,
+    source => "puppet:///modules/hdp2-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/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/templates/configuration.xsl.erb
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/templates/configuration.xsl.erb?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/templates/configuration.xsl.erb (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/templates/configuration.xsl.erb Mon Oct 15 05:55:46 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/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/templates/log4j.properties.erb
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/templates/log4j.properties.erb?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/templates/log4j.properties.erb (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/templates/log4j.properties.erb Mon Oct 15 05:55:46 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/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/templates/zoo.cfg.erb
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/templates/zoo.cfg.erb?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/templates/zoo.cfg.erb (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/templates/zoo.cfg.erb Mon Oct 15 05:55:46 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/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/templates/zookeeper-env.sh.erb
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/templates/zookeeper-env.sh.erb?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/templates/zookeeper-env.sh.erb (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2-zookeeper/templates/zookeeper-env.sh.erb Mon Oct 15 05:55:46 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/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_args_as_array.rb
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_args_as_array.rb?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_args_as_array.rb (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_args_as_array.rb Mon Oct 15 05:55:46 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

Added: incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_array_from_comma_list.rb
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_array_from_comma_list.rb?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_array_from_comma_list.rb (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_array_from_comma_list.rb Mon Oct 15 05:55:46 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.
+#
+#
+module Puppet::Parser::Functions
+  newfunction(:hdp_array_from_comma_list, :type => :rvalue) do |args|
+    args = [args].flatten
+    function_hdp_is_empty(args[0]) ? "" : args[0].split(",") 
+  end
+end

Added: incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_calc_xmn_from_xms.rb
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_calc_xmn_from_xms.rb?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_calc_xmn_from_xms.rb (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_calc_xmn_from_xms.rb Mon Oct 15 05:55:46 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.
+#
+#
+module Puppet::Parser::Functions
+  newfunction(:hdp_calc_xmn_from_xms, :type => :rvalue) do |args|
+    heapsize_orig_str = args[0].to_s
+    xmn_percent = args[1].to_f
+    xmn_max = args[2].to_i
+    heapsize_str = heapsize_orig_str.gsub(/\D/,"")
+    heapsize = heapsize_str.to_i
+    heapsize_unit = heapsize_orig_str.gsub(/\d/,"")
+    xmn_val = heapsize*xmn_percent
+    xmn_val = xmn_val.floor.to_i
+    xmn_val = xmn_val/8
+    xmn_val = xmn_val*8
+    xmn_val = xmn_val > xmn_max ? xmn_max : xmn_val
+    xmn_val_str = "" + xmn_val.to_s + heapsize_unit
+    xmn_val_str
+  end
+end

Added: incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_default.rb
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_default.rb?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_default.rb (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_default.rb Mon Oct 15 05:55:46 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.
+#
+#
+module Puppet::Parser::Functions
+  newfunction(:hdp_default, :type => :rvalue) do |args|
+    args = function_hdp_args_as_array(args)
+    scoped_var_name = args[0]
+    var_name = scoped_var_name.split("/").last
+    default = args[1]
+    val = lookupvar("::#{var_name}")
+    function_hdp_is_empty(val) ? (default||"") : val
+  end
+end
+
+

Added: incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_fail.rb
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_fail.rb?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_fail.rb (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_fail.rb Mon Oct 15 05:55:46 2012
@@ -0,0 +1,27 @@
+#
+#
+# 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.
+#
+#
+module Puppet::Parser::Functions
+  newfunction(:hdp_fail) do |args|
+    args = [args].flatten
+    msg = args[0]
+    function_fail(msg)
+  end
+end

Added: incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_host.rb
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_host.rb?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_host.rb (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_host.rb Mon Oct 15 05:55:46 2012
@@ -0,0 +1,28 @@
+#
+#
+# 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.
+#
+#
+module Puppet::Parser::Functions
+  newfunction(:hdp_host, :type => :rvalue) do |args|
+    args = function_hdp_args_as_array(args)
+    var = args[0]
+    val = lookupvar(var)
+    function_hdp_is_empty(val) ? "" : val 
+  end
+end

Added: incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_host_attribute.rb
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_host_attribute.rb?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_host_attribute.rb (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_host_attribute.rb Mon Oct 15 05:55:46 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.
+#
+#
+module Puppet::Parser::Functions
+  newfunction(:hdp_host_attribute, :type => :rvalue) do |args|
+    args = function_hdp_args_as_array(args)
+    hash,attr,source = args
+    ret_val = lambda do |hash,attr,s|
+      ret = ""
+      ndx = hash[s]
+      unless function_hdp_is_empty(ndx)
+        val = ndx[attr]
+        ret = function_hdp_is_empty(val) ? "" : val
+      end
+      ret
+    end
+    if source.kind_of?(Array)
+      source.map{|s|ret_val.call(hash,attr,s)}
+    else
+     ret_val.call(hash,attr,source)
+    end
+  end
+end

Added: incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_is_empty.rb
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_is_empty.rb?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_is_empty.rb (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_is_empty.rb Mon Oct 15 05:55:46 2012
@@ -0,0 +1,27 @@
+#
+#
+# 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.
+#
+#
+module Puppet::Parser::Functions
+  newfunction(:hdp_is_empty, :type => :rvalue) do |args|
+    args = function_hdp_args_as_array(args)
+    el = args[0]
+    el.nil? or (el.respond_to?(:to_s) and ["undefined","undef",""].include?(el.to_s))
+  end
+end

Added: incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_java_home.rb
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_java_home.rb?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_java_home.rb (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_java_home.rb Mon Oct 15 05:55:46 2012
@@ -0,0 +1,29 @@
+#
+#
+# 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.
+#
+#
+module Puppet::Parser::Functions
+  newfunction(:hdp_java_home, :type => :rvalue) do 
+    size = lookupvar("size")
+    if size.nil? or size == :undefined
+      size = "64"
+    end
+    lookupvar("::hdp2::params::java#{size.to_s}_home")
+  end
+end

Added: incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_no_hosts.rb
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_no_hosts.rb?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_no_hosts.rb (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_no_hosts.rb Mon Oct 15 05:55:46 2012
@@ -0,0 +1,27 @@
+#
+#
+# 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.
+#
+#
+module Puppet::Parser::Functions
+  newfunction(:hdp_no_hosts, :type => :rvalue) do |args|
+    args = function_hdp_args_as_array(args)
+    var = args[0]
+    function_hdp_is_empty(function_hdp_host(var))
+  end
+end

Added: incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_option_value.rb
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_option_value.rb?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_option_value.rb (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_option_value.rb Mon Oct 15 05:55:46 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.
+#
+#
+module Puppet::Parser::Functions
+  newfunction(:hdp_option_value, :type => :rvalue) do |args|
+    args = [args].flatten
+    opts = args[0]
+    key = args[1]
+    if opts.kind_of?(Hash) and not function_hdp_is_empty(key)
+      opts[key]||:undef
+    else
+      :undef
+    end
+  end
+end

Added: incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_template_var.rb
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_template_var.rb?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_template_var.rb (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_template_var.rb Mon Oct 15 05:55:46 2012
@@ -0,0 +1,35 @@
+#
+#
+# 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.
+#
+#
+module Puppet::Parser::Functions
+  newfunction(:hdp_template_var, :type => :rvalue) do |args|
+    args = [args].flatten
+    qualified_var = args[0]
+    unless qualified_var =~ /^::/
+      #module_name = lookupvar("module_name")||"UNKNOWN"
+      #qualified_var = "::#{module_name}::params::#{args[0]}"
+      component = lookupvar("component")||"UNKNOWN"
+      module_name = (component == "base" ? "::hdp2" : "::hdp2-#{component}")      
+      qualified_var = "#{module_name}::params::#{args[0]}"
+    end
+    val = lookupvar(qualified_var)
+    (val.nil? or val == :undefined) ? "" : val 
+  end
+end

Added: incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_unique_id_and_date.rb
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_unique_id_and_date.rb?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_unique_id_and_date.rb (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_unique_id_and_date.rb Mon Oct 15 05:55:46 2012
@@ -0,0 +1,27 @@
+#
+#
+# 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.
+#
+#
+module Puppet::Parser::Functions
+  newfunction(:hdp_unique_id_and_date, :type => :rvalue) do 
+    id = lookupvar('::uniqueid')
+    date = `date +"%M%d%y"`.chomp
+    "id#{id}_date#{date}"
+  end
+end

Added: incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_user.rb
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_user.rb?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_user.rb (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/lib/puppet/parser/functions/hdp_user.rb Mon Oct 15 05:55:46 2012
@@ -0,0 +1,28 @@
+#
+#
+# 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.
+#
+#
+module Puppet::Parser::Functions
+  newfunction(:hdp_user, :type => :rvalue) do |args|
+    args = [args].flatten
+    user = args[0]
+    val = lookupvar("::hdp2::params::#{user}")
+    (val.nil? or val == :undefined) ? "" : val 
+  end
+end

Added: incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/manifests/.directory
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/manifests/.directory?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/manifests/.directory (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/manifests/.directory Mon Oct 15 05:55:46 2012
@@ -0,0 +1,3 @@
+[Dolphin]
+Timestamp=2011,3,16,9,26,14
+ViewMode=1

Added: incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/manifests/configfile.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/manifests/configfile.pp?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/manifests/configfile.pp (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/manifests/configfile.pp Mon Oct 15 05:55:46 2012
@@ -0,0 +1,85 @@
+#
+#
+# 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.
+#
+#
+define hdp2::configfile(
+  $component,
+  $conf_dir = undef, #if this is undef then name is of form conf_dir/file_name
+  $owner = undef, 
+  $group = $hdp2::params::hadoop_user_group,
+  $mode = undef,
+  $size = 64, #32 or 64 bit (used to pick appropriate java_home)
+  $template_tag = undef,
+  $namenode_host = $hdp2::params::namenode_host,
+  $yarn_rm_host = $hdp2::params::yarn_rm_host,
+  $snamenode_host = $hdp2::params::snamenode_host,
+  $slave_hosts = $hdp2::params::slave_hosts,
+  $hbase_rs_hosts = $hdp2::params::hbase_rs_hosts,
+  $zookeeper_hosts = $hdp2::params::zookeeper_hosts,
+  $hbase_master_host = $hdp2::params::hbase_master_host,
+  $hcat_server_host = $hdp2::params::hcat_server_host,
+  $hive_server_host = $hdp2::params::hive_server_host,
+  $oozie_server = $hdp2::params::oozie_server,
+  $templeton_server_host = $hdp2::params::templeton_server_host,
+  $hcat_mysql_host = $hdp2::params::hcat_mysql_host,
+  $nagios_server_host = $hdp2::params::nagios_server_host,
+  $ganglia_server_host = $hdp2::params::ganglia_server_host,
+  $dashboard_host = $hdp2::params::dashboard_host,
+  $gateway_host = $hdp2::params::gateway_host,
+  $public_namenode_host = $hdp2::params::public_namenode_host,
+  $public_snamenode_host = $hdp2::params::public_snamenode_host,
+  $public_yarn_rm_host = $hdp2::params::public_yarn_rm_host,
+  $public_hbase_master_host = $hdp2::params::public_hbase_master_host,
+  $public_zookeeper_hosts = $hdp2::params::public_zookeeper_hosts,
+  $public_ganglia_server_host = $hdp2::params::public_ganglia_server_host,
+  $public_nagios_server_host = $hdp2::params::public_nagios_server_host,
+  $public_dashboard_host = $hdp2::params::public_dashboard_host,
+  $public_hive_server_host = $hdp2::params::public_hive_server_host,
+  $public_oozie_server = $hdp2::params::public_oozie_server,
+  $public_templeton_server_host = $hdp2::params::public_templeton_server_host
+) 
+{
+
+   if ($conf_dir == undef) {
+     $qualified_file_name = $name
+     $file_name = regsubst($name,'^.+/([^/]+$)','\1')
+   } else {
+     $qualified_file_name = "${conf_dir}/${name}"
+     $file_name = $name
+   }
+   if ($component == 'base') {
+     $module = 'hdp2'
+   } else {
+      $module = "hdp2-${component}"   
+   }
+
+   if ($template_tag == undef) {  
+     $template_name = "${module}/${file_name}.erb"
+   } else {
+     $template_name = "${module}/${file_name}-${template_tag}.erb"
+   }
+
+   file{ $qualified_file_name:
+     ensure  => present,
+     owner   => $owner,
+     group   => $group,
+     mode    => $mode,
+     content => template($template_name)
+  }
+}

Added: incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/manifests/init.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/manifests/init.pp?rev=1398196&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/manifests/init.pp (added)
+++ incubator/ambari/branches/branch-0.9-h2-dev/hmc/puppet/modules/hdp2/manifests/init.pp Mon Oct 15 05:55:46 2012
@@ -0,0 +1,301 @@
+#
+#
+# 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 hdp2(
+  $service_state = undef,
+  $pre_installed_pkgs = undef
+)
+{
+  import 'params.pp'
+  include hdp2::params
+  
+  Exec { logoutput => 'on_failure' }
+ 
+  group { $hdp2::params::hadoop_user_group :
+    ensure => present
+  }
+
+  #TODO: think not needed and also there seems to be a puppet bug around this and ldap
+  hdp2::user { $hdp2::params::hadoop_user:
+    gid => $hdp2::params::hadoop_user_group
+  }
+  Group[$hdp2::params::hadoop_user_group] -> Hdp2::User[$hdp2::params::hadoop_user] 
+  class { 'hdp2::snmp': service_state => 'running'}
+
+  class { 'hdp2::create_smoke_user': }
+
+  if ($pre_installed_pkgs != undef) {
+    class { 'hdp2::pre_install_pkgs': }
+  }
+
+  #turns off selinux
+  class { 'hdp2::set_selinux': }
+
+  if ($service_state != 'uninstalled') {
+    if ($hdp2::params::mapreduce_lzo_enabled == true) {
+      @hdp2::lzo::package{ 32:}
+      @hdp2::lzo::package{ 64:}
+    }
+  }
+
+  #TODO: treat consistently 
+  if ($service_state != 'uninstalled') {
+    if ($hdp2::params::mapreduce_snappy_enabled == true) {
+      include hdp2::snappy::package
+    }
+  }
+
+  Hdp2::Package<|title == 'hadoop 32'|> ->   Hdp2::Package<|title == 'hbase'|>
+  Hdp2::Package<|title == 'hadoop 64'|> ->   Hdp2::Package<|title == 'hbase'|>
+
+  #TODO: just for testing
+  class{ 'hdp2::iptables': 
+    ensure => stopped,
+  }
+
+  case $hdp2::params::hdp_os_type {
+    centos6, rhel6: {
+      hdp2::package{ 'glibc-rhel6':
+        ensure       => 'present',
+        size         => $size,
+        java_needed  => false,
+        lzo_needed   => false
+      }
+    }
+  }
+
+}
+
+class hdp2::pre_install_pkgs
+{
+  if ($service_state == 'installed_and_configured') {
+    hdp2::exec{ 'yum install $pre_installed_pkgs':
+       command => "yum install -y $pre_installed_pkgs"
+    }
+  } elsif ($service_state == 'uninstalled') {
+    hdp2::exec{ 'yum erase $pre_installed_pkgs':
+       command => "yum erase -y $pre_installed_pkgs"
+    }
+  }
+}
+
+class hdp2::create_smoke_user()
+{
+  $smoke_group = $hdp2::params::smoke_user_group
+  $smoke_user = $hdp2::params::smokeuser
+
+  group { $smoke_group :
+    ensure => present
+  }
+
+  hdp2::user { $smoke_user:}
+
+  $cmd = "usermod -g  $smoke_group  $smoke_user"
+  $check_group_cmd = "id -gn $smoke_user | grep $smoke_group"
+  hdp2::exec{ $cmd:
+     command => $cmd,
+     unless => $check_group_cmd
+  }
+ 
+  Group[$smoke_group] -> Hdp2::User[$smoke_user] -> Hdp2::Exec[$cmd] 
+}
+
+
+class hdp2::set_selinux()
+{
+ $cmd = "/bin/echo 0 > /selinux/enforce"
+ hdp2::exec{ $cmd:
+    command => $cmd,
+    unless => "head -n 1 /selinux/enforce | grep ^0$"
+  }
+}
+
+define hdp2::user(
+  $gid = $hdp2::params::hadoop_user_group,
+  $just_validate = undef
+)
+{
+  $user_info = $hdp2::params::user_info[$name]
+  if ($just_validate != undef) {
+    $just_val  = $just_validate
+  } elsif (($user_info == undef) or ("|${user_info}|" == '||')){ #tests for different versions of Puppet
+    $just_val = false
+  } else {
+    $just_val = $user_info[just_validate]
+  }
+  
+  if ($just_val == true) {
+    exec { "user ${name} exists":
+      command => "su - ${name} -c 'ls /dev/null' >/dev/null 2>&1",
+      path    => ['/bin']
+    }
+  } else {
+    user { $name:
+      ensure     => present,
+      managehome => true,
+      #gid        => $gid, #TODO either remove this to support LDAP env or fix it
+      shell      => '/bin/bash'
+    }
+  }
+}
+     
+define hdp2::directory(
+  $owner = $hdp2::params::hadoop_user,
+  $group = $hdp2::params::hadoop_user_group,
+  $mode  = undef,
+  $ensure = directory,
+  $force = undef,
+  $service_state = 'running'
+  )
+{
+ if (($service_state == 'uninstalled') and ($wipeoff_data == true)) {
+  file { $name :
+    ensure => absent,
+    owner  => $owner,
+    group  => $group,
+    mode   => $mode,
+    force  => $force
+   }
+  } elsif ($service_state != 'uninstalled') {
+  file { $name :
+    ensure => present,
+    owner  => $owner,
+    group  => $group,
+    mode   => $mode,
+    force  => $force
+   }
+  }
+}
+#TODO: check on -R flag and use of recurse
+define hdp2::directory_recursive_create(
+  $owner = $hdp2::params::hadoop_user,
+  $group = $hdp2::params::hadoop_user_group,
+  $mode = undef,
+  $context_tag = undef,
+  $ensure = directory,
+  $force = undef,
+  $service_state = 'running'
+  )
+{
+  hdp2::exec {"mkdir -p ${name}" :
+    command => "mkdir -p ${name}",
+    creates => $name
+  }
+  #to take care of setting ownership and mode
+  hdp2::directory { $name :
+    owner => $owner,
+    group => $group,
+    mode  => $mode,
+    ensure => $ensure,
+    force => $force,
+    service_state => $service_state
+  }
+  Hdp2::Exec["mkdir -p ${name}"] -> Hdp2::Directory[$name]
+}
+
+### helper to do exec
+define hdp2::exec(
+  $command,
+  $refreshonly = undef,
+  $unless = undef,
+  $onlyif = undef,
+  $path = $hdp2::params::exec_path,
+  $user = undef,
+  $creates = undef,
+  $tries = 1,
+  $timeout = 900,
+  $try_sleep = undef,
+  $initial_wait = undef,
+  $logoutput = 'on_failure',
+  $cwd = undef
+)
+{
+     
+  if (($initial_wait != undef) and ($initial_wait != "undef")) {
+    #passing in creates and unless so dont have to wait if condition has been acheived already
+    hdp2::wait { "service ${name}" : 
+      wait_time => $initial_wait,
+      creates   => $creates,
+      unless    => $unless,
+      onlyif    => $onlyif,
+      path      => $path
+    }
+  }
+  
+  exec { $name :
+    command     => $command,
+    refreshonly => $refreshonly,
+    path        => $path,
+    user        => $user,
+    creates     => $creates,
+    unless      => $unless,
+    onlyif      => $onlyif,
+    tries       => $tries,
+    timeout     => $timeout,
+    try_sleep   => $try_sleep,
+    logoutput   => $logoutput,
+    cwd         => $cwd
+  }
+  
+  anchor{ "hdp2::exec::${name}::begin":} -> Exec[$name] -> anchor{ "hdp2::exec::${name}::end":} 
+  if (($initial_wait != undef) and ($initial_wait != "undef")) {
+    Anchor["hdp2::exec::${name}::begin"] -> Hdp2::Wait["service ${name}"] -> Exec[$name]
+  }
+}
+
+#### utilities for waits
+define hdp2::wait(
+  $wait_time,
+  $creates = undef,
+  $unless = undef,
+  $onlyif = undef,
+  $path = undef #used for unless
+)   
+{
+  exec { "wait ${name} ${wait_time}" :
+    command => "/bin/sleep ${wait_time}",
+    creates => $creates,
+    unless  => $unless,
+    onlyif  => $onlyif,
+    path    => $path
+  } 
+}
+
+#### artifact_dir
+define hdp2::artifact_dir()
+{
+  include hdp2_artifact_dir_shared
+}
+class hdp2_artifact_dir_shared()
+{
+  file{ $hdp2::params::artifact_dir:
+    ensure  => directory
+  }
+}
+
+##### temp
+
+class hdp2::iptables($ensure)
+{
+  #TODO: just temp so not considering things like saving firewall rules
+  service { 'iptables':
+    ensure => $ensure
+  }
+}