fapifta commented on a change in pull request #1667:
URL: https://github.com/apache/ozone/pull/1667#discussion_r543029000



##########
File path: hadoop-ozone/dist/src/shell/hdds/workers.sh
##########
@@ -20,40 +20,43 @@
 #
 # Environment Variables
 #
-#   HADOOP_WORKERS    File naming remote hosts.
-#     Default is ${HADOOP_CONF_DIR}/workers.
-#   HADOOP_CONF_DIR  Alternate conf dir. Default is ${HADOOP_HOME}/conf.
-#   HADOOP_WORKER_SLEEP Seconds to sleep between spawning remote commands.
-#   HADOOP_SSH_OPTS Options passed to ssh when running remote commands.
+#   OZONE_WORKERS    File naming remote hosts.
+#     Default is ${OZONE_CONFIG_DIR}/workers.
+#   OZONE_CONFIG_DIR  Alternate conf dir. Default is ${OZONE_HOME}/conf.
+#   OZONE_WORKER_SLEEP Seconds to sleep between spawning remote commands.
+#   OZONE_SSH_OPTS Options passed to ssh when running remote commands.
 ##
 
-function hadoop_usage
+function ozone_usage
 {
   echo "Usage: workers.sh [--config confdir] command..."
 }
 
-# let's locate libexec...
-if [[ -n "${HADOOP_HOME}" ]]; then
-  HADOOP_DEFAULT_LIBEXEC_DIR="${HADOOP_HOME}/libexec"
-else
-  this="${BASH_SOURCE-$0}"
-  bin=$(cd -P -- "$(dirname -- "${this}")" >/dev/null && pwd -P)
-  HADOOP_DEFAULT_LIBEXEC_DIR="${bin}/../libexec"
+# load functions
+for dir in "${OZONE_LIBEXEC_DIR}" "${OZONE_HOME}/libexec" 
"${HADOOP_LIBEXEC_DIR}" "${HADOOP_HOME}/libexec" "${bin}/../libexec"; do
+  if [[ -e "${dir}/ozone-functions.sh" ]]; then
+    . "${dir}/ozone-functions.sh"
+    if declare -F ozone_bootstrap >& /dev/null; then
+      break
+    fi
+  fi
+done
+
+if ! declare -F ozone_bootstrap >& /dev/null; then
+  echo "ERROR: Cannot find ozone-functions.sh." 2>&1
+  exit 1
 fi
 
-HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$HADOOP_DEFAULT_LIBEXEC_DIR}"
-# shellcheck disable=SC2034
-HADOOP_NEW_CONFIG=true
-if [[ -f "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh" ]]; then
-  . "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh"
-else
-  echo "ERROR: Cannot execute ${HADOOP_LIBEXEC_DIR}/hadoop-config.sh." 2>&1
+if ! ozone_bootstrap; then

Review comment:
       This seems to be a strange one here...
   So in line 45 if ozone_bootstrap is not declared, we error out because 
ozone-functions.sh could not be loaded.
   
   As I understand here we check for the exit status of ozone_bootstrap 
function, and if it is false we exit because we can not find ozone-config.sh. 
Why we need this second check? As I see the ozone_bootstrap function is not 
doing anything that should fail, but maybe my eye slipped through something.
   
   This same we do in hadoop-ozone/dist/src/shell/ozone/ozone, in 
hadoop-ozone/dist/src/shell/ozone/start-ozone.sh and in 
hadoop-ozone/dist/src/shell/ozone/stop-ozone.sh files as well




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to