BIGTOP-1651: puppet: Format namenode and zkfc in noninteractive mode

Format namenode and zkfc using noninteractive mode and honour return
codes.


Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo
Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/1883e81c
Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/1883e81c
Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/1883e81c

Branch: refs/heads/master
Commit: 1883e81c3b0157683dbec275dabbd46735b5b060
Parents: ba936c0
Author: Michael Weiser <[email protected]>
Authored: Thu Feb 5 18:58:55 2015 +0100
Committer: Roman Shaposhnik <[email protected]>
Committed: Thu Feb 5 21:18:00 2015 +0000

----------------------------------------------------------------------
 bigtop-deploy/puppet/modules/hadoop/manifests/init.pp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bigtop/blob/1883e81c/bigtop-deploy/puppet/modules/hadoop/manifests/init.pp
----------------------------------------------------------------------
diff --git a/bigtop-deploy/puppet/modules/hadoop/manifests/init.pp 
b/bigtop-deploy/puppet/modules/hadoop/manifests/init.pp
index 22efea8..cc3b83f 100644
--- a/bigtop-deploy/puppet/modules/hadoop/manifests/init.pp
+++ b/bigtop-deploy/puppet/modules/hadoop/manifests/init.pp
@@ -391,17 +391,19 @@ class hadoop {
     if ($::fqdn == $first_namenode) {
       exec { "namenode format":
         user => "hdfs",
-        command => "/bin/bash -c 'yes Y | hdfs namenode -format >> 
/var/lib/hadoop-hdfs/nn.format.log 2>&1'",
+        command => "/bin/bash -c 'hdfs namenode -format -nonInteractive >> 
/var/lib/hadoop-hdfs/nn.format.log 2>&1'",
+        returns => [ 0, 1],
         creates => "${dirs[0]}/current/VERSION",
         require => [ Package["hadoop-hdfs-namenode"], File[$dirs], 
File["/etc/hadoop/conf/hdfs-site.xml"] ],
         tag     => "namenode-format",
-      } 
+      }
 
       if ($ha != "disabled") {
         if ($ha == "auto") {
           exec { "namenode zk format":
             user => "hdfs",
-            command => "/bin/bash -c 'yes N | hdfs zkfc -formatZK >> 
/var/lib/hadoop-hdfs/zk.format.log 2>&1 || :'",
+            command => "/bin/bash -c 'hdfs zkfc -formatZK -nonInteractive >> 
/var/lib/hadoop-hdfs/zk.format.log 2>&1'",
+            returns => [ 0, 2],
             require => [ Package["hadoop-hdfs-zkfc"], 
File["/etc/hadoop/conf/hdfs-site.xml"] ],
             tag     => "namenode-format",
           }

Reply via email to