Fix unstack issues

If we run ./unstack.sh more than once, issues will happen:
1. stop-dfs.sh do not exist
2. ~/.bashrc will be emptied due to $line is empty

Change-Id: Iaa058a33ddf7fe4366ffc6c7ea4e408d6b267967
This commit is contained in:
Li, Chen 2015-08-21 15:05:41 +08:00
parent c27fab5223
commit 49662d99fb
1 changed files with 8 additions and 3 deletions

View File

@ -57,10 +57,15 @@ function start_hdfs {
# Stop running hdfs service
# Triggered from devstack/plugin.sh as part of devstack "unstack"
function stop_hdfs {
$HDFS_PLUGIN_HADOOP_DIR/sbin/stop-dfs.sh
rm -rf $HDFS_PLUGIN_HADOOP_DIR
if [[ -d $HDFS_PLUGIN_HADOOP_DIR ]]; then
$HDFS_PLUGIN_HADOOP_DIR/sbin/stop-dfs.sh
rm -rf $HDFS_PLUGIN_HADOOP_DIR
fi
line=`grep -rn "export PATH=.*hadoop/bin" ~/.bashrc | awk -F: '{print $1}'`
sed -i "${line}d" ~/.bashrc
if [[ -n $line ]]; then
sed -i "${line}d" ~/.bashrc
fi
}
# Cleanup hdfs