You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by vg...@apache.org on 2012/05/15 04:40:45 UTC

svn commit: r1338514 - in /incubator/ambari/branches/ambari-186: ./ hmc/puppet/modules/hdp-hadoop/manifests/ hmc/puppet/modules/hdp/manifests/

Author: vgogate
Date: Tue May 15 02:40:45 2012
New Revision: 1338514

URL: http://svn.apache.org/viewvc?rev=1338514&view=rev
Log:
AMBARI-231.Support hadoop cleanup by Ramya Sunil

Modified:
    incubator/ambari/branches/ambari-186/CHANGES.txt
    incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-hadoop/manifests/datanode.pp
    incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-hadoop/manifests/jobtracker.pp
    incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-hadoop/manifests/namenode.pp
    incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-hadoop/manifests/service.pp
    incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-hadoop/manifests/snamenode.pp
    incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-hadoop/manifests/tasktracker.pp
    incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp/manifests/init.pp
    incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp/manifests/params.pp

Modified: incubator/ambari/branches/ambari-186/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/CHANGES.txt?rev=1338514&r1=1338513&r2=1338514&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/CHANGES.txt (original)
+++ incubator/ambari/branches/ambari-186/CHANGES.txt Tue May 15 02:40:45 2012
@@ -2,6 +2,8 @@ Ambari Change log
 
 Release 0.x.x - unreleased
 
+  AMBARI-231. Support hadoop cleanup (by Ramya Sunil via vgogate)
+
   AMBARI-228. Ganglia reports on host types not present (Richard Pelavin via vgogate)
 
   AMBARI-227. Invalid parameter ensure in ganglia manifests (Ramya Sunil via vgogate)

Modified: incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-hadoop/manifests/datanode.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-hadoop/manifests/datanode.pp?rev=1338514&r1=1338513&r2=1338514&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-hadoop/manifests/datanode.pp (original)
+++ incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-hadoop/manifests/datanode.pp Tue May 15 02:40:45 2012
@@ -58,11 +58,11 @@ class hdp-hadoop::datanode(
 
 define hdp-hadoop::datanode::create_data_dirs($service_state)
 {
-  if ($service_state != 'uninstalled') {
-    $dirs = hdp_array_from_comma_list($name)    
-    hdp::directory_recursive_create { $dirs :
-      owner => $hdp-hadoop::params::hdfs_user,
-      mode => '0750'
-    }
+  $dirs = hdp_array_from_comma_list($name)
+  hdp::directory_recursive_create { $dirs :
+    owner => $hdp-hadoop::params::hdfs_user,
+    mode => '0750',
+    service_state => $service_state,
+    force => true
   }
 }

Modified: incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-hadoop/manifests/jobtracker.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-hadoop/manifests/jobtracker.pp?rev=1338514&r1=1338513&r2=1338514&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-hadoop/manifests/jobtracker.pp (original)
+++ incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-hadoop/manifests/jobtracker.pp Tue May 15 02:40:45 2012
@@ -58,13 +58,13 @@ class hdp-hadoop::jobtracker(
 
 define hdp-hadoop::jobtracker::create_local_dirs($service_state)
 {
-  if ($service_state != 'uninstalled') {
-    $dirs = hdp_array_from_comma_list($name)    
+    $dirs = hdp_array_from_comma_list($name)
     hdp::directory_recursive_create { $dirs :
       owner => $hdp-hadoop::params::mapred_user,
-      mode => '0755'
+      mode => '0755',
+      service_state => $service_state,
+      force => true
     }
-  }
 }
 
 class hdp-hadoop::jobtracker::hdfs-directory($service_state)

Modified: incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-hadoop/manifests/namenode.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-hadoop/manifests/namenode.pp?rev=1338514&r1=1338513&r2=1338514&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-hadoop/manifests/namenode.pp (original)
+++ incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-hadoop/manifests/namenode.pp Tue May 15 02:40:45 2012
@@ -48,11 +48,11 @@ class hdp-hadoop::namenode(
 
 define hdp-hadoop::namenode::create_name_dirs($service_state)
 {
-  if ($service_state != 'uninstalled') {
-    $dirs = hdp_array_from_comma_list($name)
-    hdp::directory_recursive_create { $dirs :
-      owner => $hdp-hadoop::params::hdfs_user,
-      mode => '0755'
-    }
+  $dirs = hdp_array_from_comma_list($name)
+  hdp::directory_recursive_create { $dirs :
+    owner => $hdp-hadoop::params::hdfs_user,
+    mode => '0755',
+    service_state => $service_state,
+    force => true
   }
 }

Modified: incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-hadoop/manifests/service.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-hadoop/manifests/service.pp?rev=1338514&r1=1338513&r2=1338514&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-hadoop/manifests/service.pp (original)
+++ incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-hadoop/manifests/service.pp Tue May 15 02:40:45 2012
@@ -28,6 +28,8 @@ define hdp-hadoop::service(
     hdp::directory_recursive_create { $pid_dir: 
       owner       => $user,
       context_tag => 'hadoop_service',
+      service_state => $service_state,
+      force => true
     }
   }
   
@@ -35,6 +37,8 @@ define hdp-hadoop::service(
     hdp::directory_recursive_create { $log_dir: 
       owner       => $user,
       context_tag => 'hadoop_service',
+      service_state => $service_state,
+      force => true
     }
   }
   if ($daemon_cmd != undef) {  

Modified: incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-hadoop/manifests/snamenode.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-hadoop/manifests/snamenode.pp?rev=1338514&r1=1338513&r2=1338514&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-hadoop/manifests/snamenode.pp (original)
+++ incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-hadoop/manifests/snamenode.pp Tue May 15 02:40:45 2012
@@ -47,11 +47,13 @@ class hdp-hadoop::snamenode(
 
 define hdp-hadoop::snamenode::create_name_dirs($service_state)
 {
-  if (($hdp::params::service_exists['hdp-hadoop::namenode'] != true) and ($service_state != 'uninstalled')) { 
-    $dirs = hdp_array_from_comma_list($name)
-    hdp::directory_recursive_create { $dirs :
-      owner => $hdp-hadoop::params::hdfs_user,
-      mode => '0755'
-    }
+ if ($hdp::params::service_exists['hdp-hadoop::namenode'] != true) {
+   $dirs = hdp_array_from_comma_list($name)
+   hdp::directory_recursive_create { $dirs :
+     owner => $hdp-hadoop::params::hdfs_user,
+     mode => '0755',
+     service_state => $service_state,
+     force => true
+   }
   }
 }

Modified: incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-hadoop/manifests/tasktracker.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-hadoop/manifests/tasktracker.pp?rev=1338514&r1=1338513&r2=1338514&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-hadoop/manifests/tasktracker.pp (original)
+++ incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-hadoop/manifests/tasktracker.pp Tue May 15 02:40:45 2012
@@ -51,11 +51,13 @@ class hdp-hadoop::tasktracker(
 
 define hdp-hadoop::tasktracker::create_local_dirs($service_state)
 {
-  if (($hdp::params::service_exists['hdp-hadoop::jobtracker'] != true) and ($service_state != 'uninstalled')) {
-    $dirs = hdp_array_from_comma_list($name)    
+  if ($hdp::params::service_exists['hdp-hadoop::jobtracker'] != true) {
+    $dirs = hdp_array_from_comma_list($name)
     hdp::directory_recursive_create { $dirs :
       owner => $hdp-hadoop::params::mapred_user,
-      mode => '0755'
+      mode => '0755',
+      service_state => $service_state,
+      force => true
     }
   }
 }

Modified: incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp/manifests/init.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp/manifests/init.pp?rev=1338514&r1=1338513&r2=1338514&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp/manifests/init.pp (original)
+++ incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp/manifests/init.pp Tue May 15 02:40:45 2012
@@ -128,14 +128,28 @@ define hdp::user(
 define hdp::directory(
   $owner = $hdp::params::hadoop_user,
   $group = $hdp::params::hadoop_user_group,
-  $mode  = undef
+  $mode  = undef,
+  $ensure = directory,
+  $force = undef,
+  $service_state = 'running'
   )
 {
+ if (($service_state == 'uninstalled') and ($wipeoff_data == true)) {
   file { $name :
-    ensure => directory,
+    ensure => absent,
     owner  => $owner,
     group  => $group,
-    mode   => $mode
+    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
@@ -143,7 +157,10 @@ define hdp::directory_recursive_create(
   $owner = $hdp::params::hadoop_user,
   $group = $hdp::params::hadoop_user_group,
   $mode = undef,
-  $context_tag = undef
+  $context_tag = undef,
+  $ensure = directory,
+  $force = undef,
+  $service_state = 'running'
   )
 {
   hdp::exec {"mkdir -p ${name}" :
@@ -154,7 +171,10 @@ define hdp::directory_recursive_create(
   hdp::directory { $name :
     owner => $owner,
     group => $group,
-    mode  => $mode
+    mode  => $mode,
+    ensure => $ensure,
+    force => $force,
+    service_state => $service_state
   }
   Hdp::Exec["mkdir -p ${name}"] -> Hdp::Directory[$name]
 }

Modified: incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp/manifests/params.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp/manifests/params.pp?rev=1338514&r1=1338513&r2=1338514&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp/manifests/params.pp (original)
+++ incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp/manifests/params.pp Tue May 15 02:40:45 2012
@@ -29,7 +29,6 @@ class hdp::params()
 
 
   if ($hostAttributes != undef) {
-    notice("I am here")
     $public_namenode_host = hdp_host_attribute($hostAttributes,"publicfqdn",$namenode_host)
     $public_snamenode_host = hdp_host_attribute($hostAttributes,"publicfqdn",$snamenode_host)
     $public_jtnode_host = hdp_host_attribute($hostAttributes,"publicfqdn",$jtnode_host)
@@ -41,18 +40,6 @@ class hdp::params()
     $public_hive_server_host = hdp_host_attribute($hostAttributes,"publicfqdn",$hive_server_host)
     $public_oozie_server = hdp_host_attribute($hostAttributes,"publicfqdn",$oozie_server)
     $public_templeton_server_host = hdp_host_attribute($hostAttributes,"publicfqdn",$templeton_server_host)
- 
-notice("$public_namenode_host")
-    #$public_namenode_host = $hostAttributes[$namenode_host]['publicfqdn']
-#    $public_snamenode_host = $hostAttributes[$snamenode_host]['publicfqdn']
-#    $public_jtnode_host = $hostAttributes[$jtnode_host]['publicfqdn']
-#    $public_hbase_master_host = $hostAttributes[$hbase_master_host]['publicfqdn']
-#    $public_ganglia_server_host = $hostAttributes[$ganglia_server_host]['publicfqdn']
-#    $public_nagios_server_host = $hostAttributes[$nagios_server_host]['publicfqdn']
-#    $public_dashboard_host = $hostAttributes[$dashboard_host]['publicfqdn']
-#    $public_hive_server_host = $hostAttributes[$hive_server_host]['publicfqdn']
-#    $public_oozie_server = $hostAttributes[$oozie_server]['publicfqdn']
-#    $public_templeton_server_host = $hostAttributes[$templeton_server_host]['publicfqdn']
   } else {
     $public_namenode_host = hdp_default("namenode_host")
     $public_snamenode_host = hdp_default("snamenode_host")
@@ -86,6 +73,8 @@ notice("$public_namenode_host")
   $java32_home = hdp_default("java32_home","/usr/jdk32/jdk1.6.0_26")
   $java64_home = hdp_default("java64_home","/usr/jdk64/jdk1.6.0_26")
   
+  $wipeoff_data =  hdp_default("wipeoff_data",false) 
+
   $jdk_location = hdp_default("jdk_location","http://download.oracle.com/otn-pub/java/jdk/6u26-b03")
   $jdk_bins = hdp_default("jdk_bins",{
     32 => "jdk-6u26-linux-i586.bin",