Author: mahadev
Date: Fri Jun  7 18:12:17 2013
New Revision: 1490762

URL: http://svn.apache.org/r1490762
Log:
AMBARI-2301. Ambari starting HDFS from the second try. (Oleksandr Diachenko via 
mahadev)

Modified:
    
incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/hdfs/directory.pp

Modified: 
incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/hdfs/directory.pp
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/hdfs/directory.pp?rev=1490762&r1=1490761&r2=1490762&view=diff
==============================================================================
--- 
incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/hdfs/directory.pp
 (original)
+++ 
incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/hdfs/directory.pp
 Fri Jun  7 18:12:17 2013
@@ -29,6 +29,7 @@ define hdp-hadoop::hdfs::directory(
 ) 
 {
   $dir_exists = "hadoop fs -ls ${name} >/dev/null 2>&1"
+  $namenode_safe_mode_off = "hadoop dfsadmin -safemode get|grep 'Safe mode is 
OFF'"
   $tries = 30
   $try_sleep = 10
  
@@ -43,6 +44,7 @@ define hdp-hadoop::hdfs::directory(
     hdp-hadoop::exec-hadoop { $mkdir_cmd:
       command   => $mkdir_cmd,
       unless    => $dir_exists,
+      onlyif    => $namenode_safe_mode_off,
       try_sleep => $try_sleep,
       tries     => $tries
     }
@@ -65,7 +67,7 @@ define hdp-hadoop::hdfs::directory(
       }
       hdp-hadoop::exec-hadoop {$chown_cmd :
         command   => $chown_cmd,
-        onlyif    => $dir_exists,
+        onlyif    => "$namenode_safe_mode_off && $dir_exists",
         try_sleep => $try_sleep,
         tries     => $tries
       }
@@ -81,7 +83,7 @@ define hdp-hadoop::hdfs::directory(
       }
       hdp-hadoop::exec-hadoop {$chmod_cmd :
         command   => $chmod_cmd,
-        onlyif    => $dir_exists,
+        onlyif    => "$namenode_safe_mode_off && $dir_exists",
         try_sleep => $try_sleep,
         tries     => $tries
       }


Reply via email to