This is an automated email from the ASF dual-hosted git repository. zjffdu pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/zeppelin.git
The following commit(s) were added to refs/heads/master by this push: new 83a7737 [ZEPPELIN-4377] Interpreter doesn't start if name has space 83a7737 is described below commit 83a773782bd4c60e8d474ebc60bfb0ead7352dd7 Author: Alex Ott <alex...@gmail.com> AuthorDate: Sun Oct 13 13:00:54 2019 +0200 [ZEPPELIN-4377] Interpreter doesn't start if name has space ### What is this PR for? We can create new interpreters based on existing ones, but we don't enforce its name, so it's possible to enter it with space and other characters, that aren't handled correctly by Bash. This PR fixes this problem for master. ### What type of PR is it? Bug Fix ### What is the Jira issue? * ZEPPELIN-4377 ### How should this be tested? * Tested manually by creating a new JDBC interpreter with name containing space, and executing it Author: Alex Ott <alex...@gmail.com> Closes #3483 from alexott/ZEPPELIN-4377 and squashes the following commits: 8f955b689 [Alex Ott] [ZEPPELIN-4377] Add UI validation for interpreter name c8fe7743c [Alex Ott] [ZEPPELIN-4377] Interpreter doesn't start if name has space --- bin/interpreter.cmd | 2 +- bin/interpreter.sh | 8 ++++---- zeppelin-web/src/app/interpreter/interpreter-create.html | 2 +- zeppelin-web/src/app/interpreter/interpreter.controller.js | 9 +++++---- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/bin/interpreter.cmd b/bin/interpreter.cmd index 8877c45..e9d0b7c 100644 --- a/bin/interpreter.cmd +++ b/bin/interpreter.cmd @@ -132,7 +132,7 @@ if defined SPARK_SUBMIT ( ) else ( set JAVA_INTP_OPTS=%JAVA_INTP_OPTS% -Dzeppelin.log.file="%ZEPPELIN_LOGFILE%" - "%ZEPPELIN_RUNNER%" !JAVA_INTP_OPTS! %ZEPPELIN_INTP_MEM% -cp %ZEPPELIN_CLASSPATH_OVERRIDES%;%CLASSPATH% %ZEPPELIN_SERVER% "%CALLBACK_HOST%" %PORT% + "%ZEPPELIN_RUNNER%" !JAVA_INTP_OPTS! %ZEPPELIN_INTP_MEM% -cp '%ZEPPELIN_CLASSPATH_OVERRIDES%;%CLASSPATH%' %ZEPPELIN_SERVER% "%CALLBACK_HOST%" %PORT% ) exit /b diff --git a/bin/interpreter.sh b/bin/interpreter.sh index 76d5435..32d7c1d 100755 --- a/bin/interpreter.sh +++ b/bin/interpreter.sh @@ -106,7 +106,7 @@ if [[ ! -z "$ZEPPELIN_IMPERSONATE_USER" ]]; then ZEPPELIN_LOGFILE+="${ZEPPELIN_IMPERSONATE_USER}-" fi ZEPPELIN_LOGFILE+="${ZEPPELIN_IDENT_STRING}-${HOSTNAME}.log" -JAVA_INTP_OPTS+=" -Dzeppelin.log.file=${ZEPPELIN_LOGFILE}" +JAVA_INTP_OPTS+=" -Dzeppelin.log.file='${ZEPPELIN_LOGFILE}'" if [[ ! -d "${ZEPPELIN_LOG_DIR}" ]]; then echo "Log dir doesn't exist, create ${ZEPPELIN_LOG_DIR}" @@ -237,9 +237,9 @@ if [[ ! -z "$ZEPPELIN_IMPERSONATE_USER" ]]; then fi if [[ -n "${SPARK_SUBMIT}" ]]; then - INTERPRETER_RUN_COMMAND+=' '` echo ${SPARK_SUBMIT} --class ${ZEPPELIN_SERVER} --driver-class-path \"${ZEPPELIN_INTP_CLASSPATH_OVERRIDES}:${ZEPPELIN_INTP_CLASSPATH}\" --driver-java-options \"${JAVA_INTP_OPTS}\" ${SPARK_SUBMIT_OPTIONS} ${ZEPPELIN_SPARK_CONF} ${SPARK_APP_JAR} ${CALLBACK_HOST} ${PORT} ${INTP_GROUP_ID} ${INTP_PORT}` + INTERPRETER_RUN_COMMAND+=' '` echo ${SPARK_SUBMIT} --class ${ZEPPELIN_SERVER} --driver-class-path \"${ZEPPELIN_INTP_CLASSPATH_OVERRIDES}:${ZEPPELIN_INTP_CLASSPATH}\" --driver-java-options \"${JAVA_INTP_OPTS}\" ${SPARK_SUBMIT_OPTIONS} ${ZEPPELIN_SPARK_CONF} ${SPARK_APP_JAR} ${CALLBACK_HOST} ${PORT} \"${INTP_GROUP_ID}\" ${INTP_PORT}` else - INTERPRETER_RUN_COMMAND+=' '` echo ${ZEPPELIN_RUNNER} ${JAVA_INTP_OPTS} ${ZEPPELIN_INTP_MEM} -cp ${ZEPPELIN_INTP_CLASSPATH_OVERRIDES}:${ZEPPELIN_INTP_CLASSPATH} ${ZEPPELIN_SERVER} ${CALLBACK_HOST} ${PORT} ${INTP_GROUP_ID} ${INTP_PORT}` + INTERPRETER_RUN_COMMAND+=' '` echo ${ZEPPELIN_RUNNER} ${JAVA_INTP_OPTS} ${ZEPPELIN_INTP_MEM} -cp \"${ZEPPELIN_INTP_CLASSPATH_OVERRIDES}:${ZEPPELIN_INTP_CLASSPATH}\" ${ZEPPELIN_SERVER} ${CALLBACK_HOST} ${PORT} \"${INTP_GROUP_ID}\" ${INTP_PORT}` fi @@ -254,7 +254,7 @@ pid=$! if [[ -z "${pid}" ]]; then exit 1; else - echo ${pid} > ${ZEPPELIN_PID} + echo ${pid} > "${ZEPPELIN_PID}" fi diff --git a/zeppelin-web/src/app/interpreter/interpreter-create.html b/zeppelin-web/src/app/interpreter/interpreter-create.html index 3078d65..611a385 100644 --- a/zeppelin-web/src/app/interpreter/interpreter-create.html +++ b/zeppelin-web/src/app/interpreter/interpreter-create.html @@ -20,7 +20,7 @@ limitations under the License. <div class="form-group" style="width:200px"> <b>Interpreter Name</b> - <input id="newInterpreterSettingName" input pu-elastic-input + <input id="newInterpreterSettingName" input pu-elastic-input pattern="^[-_a-zA-Z0-9]+$" pu-elastic-input-minwidth="180px" ng-model="newInterpreterSetting.name" /> </div> diff --git a/zeppelin-web/src/app/interpreter/interpreter.controller.js b/zeppelin-web/src/app/interpreter/interpreter.controller.js index 3465871..2fa2f3b 100644 --- a/zeppelin-web/src/app/interpreter/interpreter.controller.js +++ b/zeppelin-web/src/app/interpreter/interpreter.controller.js @@ -486,20 +486,21 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou $scope.addNewInterpreterSetting = function() { // user input validation on interpreter creation if (!$scope.newInterpreterSetting.name || - !$scope.newInterpreterSetting.name.trim() || !$scope.newInterpreterSetting.group) { + !$scope.newInterpreterSetting.name.trim() || + !$scope.newInterpreterSetting.name.match(/^[-_a-zA-Z0-9]+$/g)) { BootstrapDialog.alert({ closable: true, title: 'Add interpreter', - message: 'Please fill in interpreter name and choose a group', + message: 'Interpreter name shouldn\'t be empty, and can consist only of: -_a-zA-Z0-9', }); return; } - if ($scope.newInterpreterSetting.name.indexOf('.') >= 0) { + if (!$scope.newInterpreterSetting.group) { BootstrapDialog.alert({ closable: true, title: 'Add interpreter', - message: '\'.\' is invalid for interpreter name', + message: 'Please choose an interpreter group', }); return; }