zeppelin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zjf...@apache.org
Subject [zeppelin] branch branch-0.8 updated: ZEPPELIN-4377 (0.8) Interpreter doesn't start if its name has space
Date Thu, 24 Oct 2019 14:46:15 GMT
This is an automated email from the ASF dual-hosted git repository.

zjffdu pushed a commit to branch branch-0.8
in repository https://gitbox.apache.org/repos/asf/zeppelin.git


The following commit(s) were added to refs/heads/branch-0.8 by this push:
     new 882433c  ZEPPELIN-4377 (0.8) Interpreter doesn't start if its name has space
882433c is described below

commit 882433cde5f7ae54b6527258c096c4be0dff7c9c
Author: Alex Ott <alexott@gmail.com>
AuthorDate: Sun Oct 13 13:00:54 2019 +0200

    ZEPPELIN-4377 (0.8) Interpreter doesn't start if its 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.
    
    ### What type of PR is it?
    Bug Fix
    
    ### What is the Jira issue?
    
    * ZEPPELIN-4377
    
    ### How should this be tested?
    
    * Tested manually
    
    Author: Alex Ott <alexott@gmail.com>
    Author: Jeff Zhang <zjffdu@apache.org>
    Author: Alex Ott <alexey.ott@datastax.com>
    
    Closes #3482 from alexott/ZEPPELIN-4377-0.8 and squashes the following commits:
    
    ac884c14e [Alex Ott] [ZEPPELIN-4377] Add UI validation for interpreter name
    0cc4afcdb [Alex Ott] [ZEPPELIN-4377] Interpreter doesn't start if name has space
    f7a77e442 [Alex Ott] Merge branch 'branch-0.8' of git://github.com/apache/zeppelin into
branch-0.8
    fecd6ea66 [Alex Ott] Merge branch 'branch-0.8' of git://github.com/apache/zeppelin into
branch-0.8
    74e29d1a2 [Alex Ott] Merge branch 'branch-0.8' of github.com:apache/zeppelin into branch-0.8
    7cbaa4a31 [Alex Ott] Merge branch 'branch-0.8' of github.com:apache/zeppelin into branch-0.8
    3040700ce [Jeff Zhang] Preparing development version 0.8.1-SNAPSHOT
    7f4f8e52b [Jeff Zhang] Preparing Apache Zeppelin release 0.8.0
---
 bin/interpreter.cmd                                        | 4 ++--
 bin/interpreter.sh                                         | 6 +++---
 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 78467c5..4132cfd 100644
--- a/bin/interpreter.cmd
+++ b/bin/interpreter.cmd
@@ -57,7 +57,7 @@ call "%bin%\functions.cmd" ADDJARINDIR "%INTERPRETER_DIR%"
 set HOSTNAME=%COMPUTERNAME%
 set ZEPPELIN_SERVER=org.apache.zeppelin.interpreter.remote.RemoteInterpreterServer
 
-set ZEPPELIN_LOGFILE=%ZEPPELIN_LOG_DIR%\zeppelin-interpreter-%INTERPRETER_ID%-%ZEPPELIN_IDENT_STRING%-%HOSTNAME%.log
+set ZEPPELIN_LOGFILE="%ZEPPELIN_LOG_DIR%\zeppelin-interpreter-%INTERPRETER_ID%-%ZEPPELIN_IDENT_STRING%-%HOSTNAME%.log"
 
 if not exist "%ZEPPELIN_LOG_DIR%" (
     echo Log dir doesn't exist, create %ZEPPELIN_LOG_DIR%
@@ -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 a8375af..44e6de8 100755
--- a/bin/interpreter.sh
+++ b/bin/interpreter.sh
@@ -105,7 +105,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}"
@@ -220,7 +220,7 @@ 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_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_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_PORT}"`
 fi
 
 
@@ -234,7 +234,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 ef6b8a5..6ef8a79 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;
     }


Mime
View raw message