diff --git a/bin/jenkins/test-redis b/bin/jenkins/test-redis index 331c1a2c..95577658 100755 --- a/bin/jenkins/test-redis +++ b/bin/jenkins/test-redis @@ -31,12 +31,10 @@ function start_redis() { echo "Starting redis..." redis-server ${REDIS_CONF} || die "Error starting redis" - echo "Redis successfully started on port ${port}" } -function stop_redis() { - port=$(redis_port) - REDIS_DIR=/tmp/redis-${port} +function stop_redis_by_dir() { + REDIS_DIR=${1} PID_FILE=${REDIS_DIR}/redis.pid if [[ ! -f ${PID_FILE} ]] ; then echo "Redis pid file not found: ${PID_FILE}" @@ -45,26 +43,44 @@ function stop_redis() { kill $(cat ${PID_FILE}) || die "Error killing redis using pid file: ${PID_FILE}" fi - echo "Removing redis dir: ${REDIS_DIR}" - rm -rf ${REDIS_DIR} || die "Error removing redis dir: ${REDIS_DIR}" + if [[ -d ${REDIS_DIR} ]] ; then + echo "Removing redis dir: ${REDIS_DIR}" + rm -rf ${REDIS_DIR} || die "Error removing redis dir: ${REDIS_DIR}" + fi +} + +function stop_redis() { + port=$(redis_port) + REDIS_DIR=/tmp/redis-${port} + stop_redis_by_dir ${REDIS_DIR} +} - echo "Redis stopped and cleaned up" +function redis_clean() { + for REDIS_DIR in $(find /tmp -maxdepth 1 -type d -name "redis-*") ; do + stop_redis_by_dir ${REDIS_DIR} + done } if [[ -z ${1} ]] ; then - die "expected one of: start stop port" + die "expected one of: start stop clean port" fi case ${1} in "start") + stop_redis start_redis + echo "Redis successfully started" ;; "stop") stop_redis + echo "Redis stopped and cleaned up" ;; "port") redis_port ;; + "clean") + redis_clean + ;; *) die "invalid argument: ${1}" ;; diff --git a/bubble-server/src/main/java/bubble/ApiConstants.java b/bubble-server/src/main/java/bubble/ApiConstants.java index 2dd17322..3ec73ac1 100644 --- a/bubble-server/src/main/java/bubble/ApiConstants.java +++ b/bubble-server/src/main/java/bubble/ApiConstants.java @@ -76,7 +76,17 @@ public class ApiConstants { public static final GoogleAuthenticator G_AUTH = new GoogleAuthenticator(); public static final Predicate ALWAYS_TRUE = m -> true; - public static final String HOME_DIR = System.getProperty("user.home"); + public static final String HOME_DIR; + static { + final String userHome = System.getProperty("user.home"); + final String envHome = System.getenv("HOME"); + if (!userHome.equals(envHome)) { + log.warn("System.getProperty(\"user.home\") == "+userHome+" differs from System.getenv(\"HOME\") == "+envHome+", using HOME from environment: "+envHome); + HOME_DIR = envHome; + } else { + HOME_DIR = userHome; + } + } public static final File CACERTS_DIR = new File(HOME_DIR, "cacerts"); public static final File MITMPROXY_CERT_DIR = new File(HOME_DIR, "mitm_certs"); diff --git a/bubble-server/src/main/java/bubble/cloud/storage/local/LocalStorageDriver.java b/bubble-server/src/main/java/bubble/cloud/storage/local/LocalStorageDriver.java index 205f2f5a..4ce80c64 100644 --- a/bubble-server/src/main/java/bubble/cloud/storage/local/LocalStorageDriver.java +++ b/bubble-server/src/main/java/bubble/cloud/storage/local/LocalStorageDriver.java @@ -26,6 +26,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static bubble.ApiConstants.HOME_DIR; import static bubble.ApiConstants.ROOT_NETWORK_UUID; import static org.cobbzilla.util.daemon.ZillaRuntime.*; import static org.cobbzilla.util.io.FileUtil.*; @@ -53,7 +54,7 @@ public class LocalStorageDriver extends CloudServiceDriverBase { System.getProperty("user.dir") + "/bubble.env" }; - private static AtomicReference restoreKey = new AtomicReference<>(); + private static final AtomicReference restoreKey = new AtomicReference<>(); public static boolean isRestoreMode () { return restoreKey.get() != null; } public static void disableRestoreMode () { final BubbleNode selfNode = nodeFromFile(THIS_NODE_FILE); diff --git a/utils/cobbzilla-utils b/utils/cobbzilla-utils index 60856285..74230fcc 160000 --- a/utils/cobbzilla-utils +++ b/utils/cobbzilla-utils @@ -1 +1 @@ -Subproject commit 60856285c4f37967fd1effc438f08878607c11a9 +Subproject commit 74230fcc51ee1177a898de135a30b5b70a760e12 diff --git a/utils/cobbzilla-wizard b/utils/cobbzilla-wizard index 13fd0bc4..4dcca7b4 160000 --- a/utils/cobbzilla-wizard +++ b/utils/cobbzilla-wizard @@ -1 +1 @@ -Subproject commit 13fd0bc476779b7c1d7c28fd7bf1171ea11703f0 +Subproject commit 4dcca7b4ca0240ad7f2cc1d60909c0ff5830339a