mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
[ZEPPELIN-408] Properly honor notebook dir from xml configuration
This commit is contained in:
parent
39417c073b
commit
d700872761
4 changed files with 23 additions and 9 deletions
|
|
@ -36,10 +36,6 @@ if [[ -z "${ZEPPELIN_LOG_DIR}" ]]; then
|
|||
export ZEPPELIN_LOG_DIR="${ZEPPELIN_HOME}/logs"
|
||||
fi
|
||||
|
||||
if [[ -z "${ZEPPELIN_NOTEBOOK_DIR}" ]]; then
|
||||
export ZEPPELIN_NOTEBOOK_DIR="${ZEPPELIN_HOME}/notebook"
|
||||
fi
|
||||
|
||||
if [[ -z "$ZEPPELIN_PID_DIR" ]]; then
|
||||
export ZEPPELIN_PID_DIR="${ZEPPELIN_HOME}/run"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -93,11 +93,6 @@ function initialize_default_directories() {
|
|||
echo "Pid dir doesn't exist, create ${ZEPPELIN_PID_DIR}"
|
||||
$(mkdir -p "${ZEPPELIN_PID_DIR}")
|
||||
fi
|
||||
|
||||
if [[ ! -d "${ZEPPELIN_NOTEBOOK_DIR}" ]]; then
|
||||
echo "Notebook dir doesn't exist, create ${ZEPPELIN_NOTEBOOK_DIR}"
|
||||
$(mkdir -p "${ZEPPELIN_NOTEBOOK_DIR}")
|
||||
fi
|
||||
}
|
||||
|
||||
function wait_for_zeppelin_to_die() {
|
||||
|
|
|
|||
|
|
@ -75,7 +75,13 @@ public class VFSNotebookRepo implements NotebookRepo {
|
|||
} else {
|
||||
this.filesystemRoot = filesystemRoot;
|
||||
}
|
||||
|
||||
fsManager = VFS.getManager();
|
||||
FileObject file = fsManager.resolveFile(filesystemRoot.getPath());
|
||||
if (!file.exists()) {
|
||||
logger.info("Notebook dir doesn't exist, create.");
|
||||
file.createFolder();
|
||||
}
|
||||
}
|
||||
|
||||
private String getPath(String path) {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,11 @@
|
|||
package org.apache.zeppelin.conf;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.apache.commons.configuration.ConfigurationException;
|
||||
import org.apache.zeppelin.conf.ZeppelinConfiguration.ConfVars;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
|
|
@ -28,6 +32,11 @@ import java.util.List;
|
|||
* Created by joelz on 8/19/15.
|
||||
*/
|
||||
public class ZeppelinConfigurationTest {
|
||||
@Before
|
||||
public void clearSystemVariables() {
|
||||
System.clearProperty(ConfVars.ZEPPELIN_NOTEBOOK_DIR.getVarName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAllowedOrigins2Test() throws MalformedURLException, ConfigurationException {
|
||||
|
||||
|
|
@ -70,4 +79,12 @@ public class ZeppelinConfigurationTest {
|
|||
Boolean isIt = conf.isWindowsPath("~/test/file.xml");
|
||||
Assert.assertFalse(isIt);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getNotebookDirTest() throws ConfigurationException {
|
||||
|
||||
ZeppelinConfiguration conf = new ZeppelinConfiguration(this.getClass().getResource("/zeppelin-site.xml"));
|
||||
String notebookLocation = conf.getNotebookDir();
|
||||
Assert.assertEquals("notebook", notebookLocation);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue