You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spot.apache.org by na...@apache.org on 2018/03/19 19:09:17 UTC
[06/15] incubator-spot git commit: Use safe_mkdir() when creating
HDFS directories and modifying permissions
Use safe_mkdir() when creating HDFS directories and modifying permissions
- Pulled most of these changes from SPOT-213
- Also updated the echo statements to use log() instead
Project: http://git-wip-us.apache.org/repos/asf/incubator-spot/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-spot/commit/4998b22a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-spot/tree/4998b22a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-spot/diff/4998b22a
Branch: refs/heads/SPOT-181_ODM
Commit: 4998b22ad4b09e2b8d0c493a17e235f0b9776e99
Parents: c83230d
Author: Tadd Wood <ta...@arcadiadata.com>
Authored: Mon Feb 12 10:26:38 2018 -0800
Committer: Tadd Wood <ta...@arcadiadata.com>
Committed: Mon Feb 12 10:48:53 2018 -0800
----------------------------------------------------------------------
spot-setup/odm/odm_setup.sh | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-spot/blob/4998b22a/spot-setup/odm/odm_setup.sh
----------------------------------------------------------------------
diff --git a/spot-setup/odm/odm_setup.sh b/spot-setup/odm/odm_setup.sh
index 4f93d05..ce87f29 100755
--- a/spot-setup/odm/odm_setup.sh
+++ b/spot-setup/odm/odm_setup.sh
@@ -104,33 +104,34 @@ else
fi
# Creating HDFS user's folder
-sudo -u hdfs hdfs dfs -mkdir ${HUSER}
-sudo -u hdfs hdfs dfs -chown ${USER}:supergroup ${HUSER}
-sudo -u hdfs hdfs dfs -chmod 775 ${HUSER}
+log "creating ${HUSER}"
+safe_mkdir ${hdfs_cmd} ${HUSER}
+${hdfs_cmd} dfs -chown ${USER}:supergroup ${HUSER}
+${hdfs_cmd} dfs -chmod 775 ${HUSER}
# Creating HDFS paths for each use case
for d in "${DSOURCES[@]}"
do
- echo "creating /$d"
- sudo -u hdfs hdfs dfs -mkdir ${HUSER}/$d
+ log "creating /$d"
+ safe_mkdir hdfs ${HUSER}/$d
# Create Avro schemas directory on HDFS if Avro storage is selected
if [ "$format" == "avro" ] ; then
- echo "creating /$d/schema"
- sudo -u hdfs hdfs dfs -mkdir ${HUSER}/$d/schema
+ log "creating ${HUSER}/$d/schema"
+ safe_mkdir ${hdfs_cmd} ${HUSER}/$d/schema
fi
for f in "${DFOLDERS[@]}"
do
- echo "creating $d/$f"
- sudo -u hdfs hdfs dfs -mkdir ${HUSER}/$d/$f
+ log "creating ${HUSER}/$d/$f"
+ safe_mkdir ${hdfs_cmd} ${HUSER}/$d/$f
done
# Modifying permission on HDFS folders to allow Impala to read/write
- echo "modifying permissions recursively on ${HUSER}/$d"
- sudo -u hdfs hdfs dfs -chmod -R 775 ${HUSER}/$d
- sudo -u hdfs hdfs dfs -setfacl -R -m user:impala:rwx ${HUSER}/$d
- sudo -u hdfs hdfs dfs -setfacl -R -m user:${USER}:rwx ${HUSER}/$d
+ log "modifying permissions recursively on ${HUSER}/$d"
+ hdfs dfs -chmod -R 775 ${HUSER}/$d
+ ${hdfs_cmd} dfs -setfacl -R -m user:impala:rwx ${HUSER}/$d
+ ${hdfs_cmd} dfs -setfacl -R -m user:${USER}:rwx ${HUSER}/$d
done
# Creating Spot Database