from fabric.api import *
from inventory import runs_on

@task
@runs_on('hadoop_master')
def start_hdfs():
    with cd('$HADOOP_HOME'):
        run('sbin/start-dfs.sh')

@task
@runs_on('hadoop_master')
def stop_hdfs():
    with cd('$HADOOP_HOME'):
        run('sbin/stop-dfs.sh')

@task
@runs_on('hadoop_master')
def format_namenode():
    with cd('$HADOOP_HOME'):
        run('bin/hdfs namenode -format -nonInteractive -clusterId hdfs-terrai-cluster')

@task
@runs_on('hadoop_master')
def balance_datanodes():
    with cd('$HADOOP_HOME'):
        run('bin/hdfs balancer -policy datanode')

@@ -324,24 +324,202 @@
 namenode():%0A
+    # Make the user confirm because this is really dangerous%0A    ans = raw_input('This will DELETE ALL DATA on HDFS, are you sure ? (%5By%7Cn%5D) ')%0A    if ans != 'y':%0A        return%0A%0A
     with cd(

Add safeguard against namenode formatting