You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bigtop.apache.org by rv...@apache.org on 2011/10/27 02:40:38 UTC

svn commit: r1189560 - in /incubator/bigtop/trunk/bigtop-deploy/puppet: manifests/cluster.pp modules/hadoop/manifests/init.pp

Author: rvs
Date: Thu Oct 27 00:40:38 2011
New Revision: 1189560

URL: http://svn.apache.org/viewvc?rev=1189560&view=rev
Log:
BIGTOP-191. refactor hadoop::create_hdfs_dirs

Modified:
    incubator/bigtop/trunk/bigtop-deploy/puppet/manifests/cluster.pp
    incubator/bigtop/trunk/bigtop-deploy/puppet/modules/hadoop/manifests/init.pp

Modified: incubator/bigtop/trunk/bigtop-deploy/puppet/manifests/cluster.pp
URL: http://svn.apache.org/viewvc/incubator/bigtop/trunk/bigtop-deploy/puppet/manifests/cluster.pp?rev=1189560&r1=1189559&r2=1189560&view=diff
==============================================================================
--- incubator/bigtop/trunk/bigtop-deploy/puppet/manifests/cluster.pp (original)
+++ incubator/bigtop/trunk/bigtop-deploy/puppet/manifests/cluster.pp Thu Oct 27 00:40:38 2011
@@ -151,6 +151,17 @@ class hadoop_head_node inherits hadoop_c
     group => mapred,
     mode => 755,
   }
+
+  hadoop::create_hdfs_dirs { [ "/mapred", "/tmp", "/system", "/user", "/hbase", "/benchmarks", "/user/jenkins", "/user/hive" ]:
+    hdfs_dirs_meta => { "/tmp"          => { perm => "777", user => "hdfs"   },
+                        "/mapred"       => { perm => "755", user => "mapred" },
+                        "/system"       => { perm => "755", user => "hdfs"   },
+                        "/user"         => { perm => "755", user => "hdfs"   },
+                        "/hbase"        => { perm => "755", user => "hbase"  },
+                        "/benchmarks"   => { perm => "777", user => "hdfs"   },
+                        "/user/jenkins" => { perm => "777", user => "jenkins"},
+                        "/user/hive"    => { perm => "777", user => "hive"   } },
+  }
 }
 
 class hadoop_gateway_node inherits hadoop_head_node {

Modified: incubator/bigtop/trunk/bigtop-deploy/puppet/modules/hadoop/manifests/init.pp
URL: http://svn.apache.org/viewvc/incubator/bigtop/trunk/bigtop-deploy/puppet/modules/hadoop/manifests/init.pp?rev=1189560&r1=1189559&r2=1189560&view=diff
==============================================================================
--- incubator/bigtop/trunk/bigtop-deploy/puppet/modules/hadoop/manifests/init.pp (original)
+++ incubator/bigtop/trunk/bigtop-deploy/puppet/modules/hadoop/manifests/init.pp Thu Oct 27 00:40:38 2011
@@ -85,25 +85,15 @@ class hadoop {
     }
   }
 
-  define create_hdfs_dirs() {
-    $hdfs_dirs_meta = { "/tmp"        => { perm => "777", user => "hdfs"   },
-                        "/mapred"     => { perm => "755", user => "mapred" },
-                        "/system"     => { perm => "755", user => "hdfs"   },
-                        "/user"       => { perm => "755", user => "hdfs"   }, 
-                        "/hbase"      => { perm => "755", user => "hbase"  }, 
-                        "/benchmarks" => { perm => "777", user => "hdfs"   }, 
-                        "/user/hudson" => { perm => "777", user => "hudson"},
-                        "/user/hive"  => { perm => "777", user => "hive"   } }
-          
-
+  define create_hdfs_dirs($hdfs_dirs_meta) {
     $user = $hdfs_dirs_meta[$title][user]
     $perm = $hdfs_dirs_meta[$title][perm]
 
     exec { "HDFS init $title":
       user => "hdfs",
-      command => "/bin/bash -c 'hadoop fs -mkdir $title && hadoop fs -chown $user $name && hadoop fs -chmod $perm $name'",
+      command => "/bin/bash -c 'hadoop fs -mkdir $title && hadoop fs -chmod $perm $title && hadoop fs -chown $user $title'",
       unless => "/bin/bash -c 'hadoop fs -ls $name >/dev/null 2>&1'",
-      require => Service["hadoop-namenode"],
+      require => [ Service["hadoop-namenode"], Exec["namenode format"] ],
     }
   }
 
@@ -136,9 +126,6 @@ class hadoop {
       creates => inline_template("<%= hadoop_storage_locations.split(';')[0] %>/namenode/image"),
       require => [Package["hadoop-namenode"]],
     }
-
-    create_hdfs_dirs { [ "/mapred", "/tmp", "/system", "/user", "/hbase", "/benchmarks", "/user/hudson", "/user/hive" ]:
-    }
   }