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:16 UTC

[05/15] incubator-spot git commit: Check no-sudo argument and set the command/user we'll run with for each hdfs command

Check no-sudo argument and set the command/user we'll run with for each hdfs command

- Pulled most of these changes from SPOT-213


Project: http://git-wip-us.apache.org/repos/asf/incubator-spot/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-spot/commit/c83230d4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-spot/tree/c83230d4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-spot/diff/c83230d4

Branch: refs/heads/SPOT-181_ODM
Commit: c83230d47565d217db10861a4621ad4ddbad0a12
Parents: 46c0f3f
Author: Tadd Wood <ta...@arcadiadata.com>
Authored: Mon Feb 12 10:20:37 2018 -0800
Committer: Tadd Wood <ta...@arcadiadata.com>
Committed: Mon Feb 12 10:48:46 2018 -0800

----------------------------------------------------------------------
 spot-setup/odm/odm_setup.sh | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-spot/blob/c83230d4/spot-setup/odm/odm_setup.sh
----------------------------------------------------------------------
diff --git a/spot-setup/odm/odm_setup.sh b/spot-setup/odm/odm_setup.sh
index 0aa46f1..4f93d05 100755
--- a/spot-setup/odm/odm_setup.sh
+++ b/spot-setup/odm/odm_setup.sh
@@ -89,6 +89,20 @@ fi
 log "Sourcing ${SPOTCONF}\n"
 source $SPOTCONF
 
+# Check no-sudo argument and set the proper hdfs command to run our create table statements later
+if [[ ${no_sudo} == "true" ]]; then
+    hdfs_cmd="hdfs"
+
+    if [[ ! -z "${HADOOP_USER_NAME}" ]]; then
+        log "HADOOP_USER_NAME: ${HADOOP_USER_NAME}"
+    else
+        log "setting HADOOP_USER_NAME to hdfs"
+        HADOOP_USER_NAME=hdfs
+    fi
+else
+    hdfs_cmd="sudo -u hdfs hdfs"
+fi
+
 # Creating HDFS user's folder
 sudo -u hdfs hdfs dfs -mkdir ${HUSER}
 sudo -u hdfs hdfs dfs -chown ${USER}:supergroup ${HUSER}