adoroszlai commented on code in PR #3864:
URL: https://github.com/apache/ozone/pull/3864#discussion_r1006117169


##########
hadoop-ozone/dist/src/shell/ozone/ozone-functions.sh:
##########
@@ -42,6 +42,38 @@ function ozone_debug
   fi
 }
 
+## @description Displays usage text for the '--validate' option
+## @audience private
+## @stability evolving
+## @replaceable yes
+function ozone_validate_classpath_usage
+{
+  description=$'The --validate flag validates if all jars as indicated in the 
corresponding OZONE_RUN_ARTIFACT_NAME classpath file are present\n\n'
+  usage_text=$'Usage I: ozone --validate classpath <ARTIFACTNAME>\nUsage II: 
ozone --validate [OPTIONS] --daemon start|status|stop 
csi|datanode|om|recon|s3g|scm\n\n'
+  options=$'  OPTIONS is none or any of:\n\ncontinue\tcommand execution shall 
continue even if validation fails'
+  ozone_error "${description}${usage_text}${options}"
+  exit 1
+}
+
+## @description Validates if all jars as indicated in the corresponding 
OZONE_RUN_ARTIFACT_NAME classpath file are present
+## @audience private
+## @stability evolving
+## @replaceable yes
+function ozone_validate_classpath
+{
+  local OZONE_OPTION_DAEMON
+  [[ "${OZONE_SUBCMD_SUPPORTDAEMONIZATION}" == true && "${OZONE_DAEMON_MODE}" 
=~ ^st(art|op|atus)$ ]] &&
+  OZONE_OPTION_DAEMON=true || OZONE_OPTION_DAEMON=false
+
+  if [[ "${OZONE_VALIDATE_CLASSPATH}" == true && ( ( 
"${OZONE_VALIDATE_FAIL_ON_MISSING_JARS}" == true &&
+        ( "${OZONE_OPTION_DAEMON}" == true || "${OZONE_SUBCMD}" == classpath ) 
) ||
+        ( "${OZONE_VALIDATE_FAIL_ON_MISSING_JARS}" == false && 
"${OZONE_OPTION_DAEMON}" == true ) ) ]]; then
+    ozone_validate_classpath_util
+  else
+    ozone_validate_classpath_usage
+  fi

Review Comment:
   Usage is printed if `--validate` is not used, preventing normal daemon 
startup (causing acceptance test failure across the board).  The function 
should do nothing if `"${OZONE_VALIDATE_CLASSPATH}" != true`.



-- 
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.

To unsubscribe, e-mail: [email protected]

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