diff --git a/bin/bdelete b/bin/bdelete index 7face85a..40f7d11e 100755 --- a/bin/bdelete +++ b/bin/bdelete @@ -24,4 +24,4 @@ SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) URL="${1:?no URL provided}" shift -exec ${SCRIPT_DIR}/bubble delete -U ${URL} ${@} +BUBBLE_QUIET=1 ${SCRIPT_DIR}/bubble delete -U ${URL} ${@} diff --git a/bin/bget b/bin/bget index cf9d6cc3..858caabf 100755 --- a/bin/bget +++ b/bin/bget @@ -24,4 +24,4 @@ SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) URL="${1:?no URL provided}" shift -exec ${SCRIPT_DIR}/bubble get -U ${URL} ${@} +BUBBLE_QUIET=1 ${SCRIPT_DIR}/bubble get -U ${URL} ${@} diff --git a/bin/bgetn b/bin/bgetn new file mode 100755 index 00000000..2c22f1f6 --- /dev/null +++ b/bin/bgetn @@ -0,0 +1,35 @@ +#!/bin/bash +# +# Run an HTTP GET against the API, then print out the "name" attribute only +# +# Usage: +# +# bgetn path [options] +# +# path : an API path +# options : bscript options, see bubble.main.BubbleScriptOptions (and parent classes) for more info +# +# Environment variables +# +# BUBBLE_API : which API to use. Default is local (http://127.0.0.1:PORT, where PORT is found in .bubble.env) +# BUBBLE_USER : account to use. Default is root +# BUBBLE_PASS : password for account. Default is root +# BUBBLE_INCLUDE : path to look for JSON include files. default value is to assume we are being run from +# bubble repo, bubble-models repo, or bubble-client and use include files from minimal model. +# +SCRIPT="${0}" +SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) +. ${SCRIPT_DIR}/bubble_common + +URL="${1:?no URL provided}" +shift + +JSON="$(BUBBLE_QUIET=1 ${SCRIPT_DIR}/bubble get -U ${URL} ${@})" +if [[ ${JSON} = \{* ]] ; then + echo "${JSON}" | jq -r .name +elif [[ "${JSON}" = \[* ]] ; then + echo "${JSON}" | jq -r .[].name +else + echo "not sure what to do with JSON:" + echo "${JSON}" +fi diff --git a/bin/bpost b/bin/bpost index e62f8320..92b5b77c 100755 --- a/bin/bpost +++ b/bin/bpost @@ -39,7 +39,7 @@ fi shift if [[ "${REQUEST_JSON}" == "-" ]] ; then - exec ${SCRIPT_DIR}/bubble post -U ${URL} ${@} + BUBBLE_QUIET=1 ${SCRIPT_DIR}/bubble post -U ${URL} ${@} else - cat ${REQUEST_JSON} | exec ${SCRIPT_DIR}/bubble post -U ${URL} ${@} + cat ${REQUEST_JSON} | BUBBLE_QUIET=1 ${SCRIPT_DIR}/bubble post -U ${URL} ${@} fi diff --git a/bin/bposte b/bin/bposte index 3adf0e03..80a52d28 100755 --- a/bin/bposte +++ b/bin/bposte @@ -25,4 +25,4 @@ SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) URL="${1:?no URL provided}" shift -cat /dev/null | exec ${SCRIPT_DIR}/bubble post -U ${URL} ${@} +cat /dev/null | BUBBLE_QUIET=1 ${SCRIPT_DIR}/bubble post -U ${URL} ${@} diff --git a/bin/bput b/bin/bput index 27f5b6e4..c6de54c5 100755 --- a/bin/bput +++ b/bin/bput @@ -39,7 +39,7 @@ fi shift if [[ "${REQUEST_JSON}" == "-" ]] ; then - exec ${SCRIPT_DIR}/bubble put -U ${URL} ${@} + BUBBLE_QUIET=1 ${SCRIPT_DIR}/bubble put -U ${URL} ${@} else - cat ${REQUEST_JSON} | exec ${SCRIPT_DIR}/bubble put -U ${URL} ${@} + cat ${REQUEST_JSON} | BUBBLE_QUIET=1 ${SCRIPT_DIR}/bubble put -U ${URL} ${@} fi diff --git a/bin/bpute b/bin/bpute index c5035f57..65b34574 100755 --- a/bin/bpute +++ b/bin/bpute @@ -25,4 +25,4 @@ SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) URL="${1:?no URL provided}" shift -cat /dev/null | exec ${SCRIPT_DIR}/bubble put -U ${URL} ${@} +cat /dev/null | BUBBLE_QUIET=1 ${SCRIPT_DIR}/bubble put -U ${URL} ${@} diff --git a/bin/bubble_common b/bin/bubble_common index 8b0d6a32..d4ce3b48 100755 --- a/bin/bubble_common +++ b/bin/bubble_common @@ -90,9 +90,12 @@ if [[ -z "${BUBBLE_JAR}" ]] ; then elif [[ -f "/home/bubble/current/bubble.jar" ]] ; then BUBBLE_JAR="/home/bubble/current/bubble.jar" else - BUBBLE_JAR="$(find ${BUBBLE_SCRIPTS}/../bubble-server/target -type f -name bubble*.jar | head -1)" + BUBBLE_JAR="$(find ${BUBBLE_SCRIPTS}/../bubble-server/target -type f -name "bubble*.jar" | head -1)" fi fi +if [[ -z "${BUBBLE_JAR}" ]] ; then + echo 1>&2 "warning: bubble jar could not be located" +fi # Check to see if we are on the PATH, if not suggest that we could be BUBBLE_BIN="$(cd $(dirname ${0}) && pwd)" diff --git a/bin/run.sh b/bin/run.sh index d7334010..b985fff5 100755 --- a/bin/run.sh +++ b/bin/run.sh @@ -55,7 +55,9 @@ if [[ -z "${BUBBLE_ENV}" ]] ; then fi fi if [[ -f ${BUBBLE_ENV} ]] ; then - echo 1>&2 "Loading env: ${BUBBLE_ENV}" + if [[ -z "${BUBBLE_QUIET}" || ${BUBBLE_QUIET} != 1 ]] ; then + echo 1>&2 "Loading env: ${BUBBLE_ENV}" + fi . ${BUBBLE_ENV} fi diff --git a/bubble-server/src/main/java/bubble/service/cloud/NodeProgressMeter.java b/bubble-server/src/main/java/bubble/service/cloud/NodeProgressMeter.java index 88fa9ed3..7b4c8ef6 100644 --- a/bubble-server/src/main/java/bubble/service/cloud/NodeProgressMeter.java +++ b/bubble-server/src/main/java/bubble/service/cloud/NodeProgressMeter.java @@ -86,6 +86,7 @@ public class NodeProgressMeter extends PipedOutputStream implements Runnable { private NodeProgressMeterTick newTick(String messageKey, String line) { return new NodeProgressMeterTick() .setAccount(nn.getAccount()) + .setNetwork(nn.getNetwork()) .setMessageKey(messageKey) .setDetails(line); } @@ -156,6 +157,7 @@ public class NodeProgressMeter extends PipedOutputStream implements Runnable { closed.set(true); background(this::close); _setCurrentTick(new NodeProgressMeterTick() + .setNetwork(nn.getNetwork()) .setAccount(nn.getAccount()) .setMessageKey(METER_COMPLETED) .setPercent(100)); diff --git a/bubble-server/src/main/java/bubble/service/cloud/NodeProgressMeterConstants.java b/bubble-server/src/main/java/bubble/service/cloud/NodeProgressMeterConstants.java index 6ed16e2d..fb07f973 100644 --- a/bubble-server/src/main/java/bubble/service/cloud/NodeProgressMeterConstants.java +++ b/bubble-server/src/main/java/bubble/service/cloud/NodeProgressMeterConstants.java @@ -73,6 +73,7 @@ public class NodeProgressMeterConstants { if (percent == null) return die("getStandardTicks: "+f.getName()+" entry missing from STANDARD_TICKS"); ticks.add(new NodeProgressMeterTick() .setAccount(nn.getAccount()) + .setNetwork(nn.getNetwork()) .setPattern(value) .setMatch(exact) .setMessageKey(f.getName().toLowerCase()) @@ -105,7 +106,9 @@ public class NodeProgressMeterConstants { public static List getInstallTicks(NewNodeNotification nn) { final NodeProgressMeterTick[] installTicks = json(stream2string(TICKS_JSON), NodeProgressMeterTick[].class); for (NodeProgressMeterTick tick : installTicks) { - tick.setAccount(nn.getAccount()).setMessageKey(INSTALL_TICK_PREFIX + tick.getMessageKey()); + tick.setNetwork(nn.getNetwork()) + .setAccount(nn.getAccount()) + .setMessageKey(INSTALL_TICK_PREFIX + tick.getMessageKey()); } return asList(installTicks); } diff --git a/bubble-server/src/main/java/bubble/service/cloud/NodeProgressMeterTick.java b/bubble-server/src/main/java/bubble/service/cloud/NodeProgressMeterTick.java index 79c91842..8df5c4a6 100644 --- a/bubble-server/src/main/java/bubble/service/cloud/NodeProgressMeterTick.java +++ b/bubble-server/src/main/java/bubble/service/cloud/NodeProgressMeterTick.java @@ -22,6 +22,9 @@ public class NodeProgressMeterTick { @Getter @Setter private String account; public boolean hasAccount() { return !empty(account); } + @Getter @Setter private String network; + public boolean hasNetwork() { return !empty(network); } + @Getter @Setter private String pattern; @JsonIgnore @Getter(lazy=true) private final Pattern _pattern = Pattern.compile(getPattern()); diff --git a/bubble-server/src/main/java/bubble/service/cloud/StandardNetworkService.java b/bubble-server/src/main/java/bubble/service/cloud/StandardNetworkService.java index 0bab634c..62329648 100644 --- a/bubble-server/src/main/java/bubble/service/cloud/StandardNetworkService.java +++ b/bubble-server/src/main/java/bubble/service/cloud/StandardNetworkService.java @@ -652,7 +652,7 @@ public class StandardNetworkService implements NetworkService { final RedisService stats = getNetworkSetupStatus(); final List ticks = new ArrayList<>(); for (String key : stats.keys(getProgressMeterPrefix(accountUuid)+"*")) { - final String json = stats.get(key); + final String json = stats.get_withPrefix(key); if (json != null) { try { ticks.add(json(json, NodeProgressMeterTick.class)); diff --git a/bubble-server/src/test/resources/models/tests/network/simple_network.json b/bubble-server/src/test/resources/models/tests/network/simple_network.json index 950bb080..97c4c39f 100644 --- a/bubble-server/src/test/resources/models/tests/network/simple_network.json +++ b/bubble-server/src/test/resources/models/tests/network/simple_network.json @@ -169,11 +169,12 @@ }, "response": { "store": "nn" - } + }, + "after": "await_url me/status 40m 20s await_json.length > 0 && await_json[0].getPercent() == 100" }, { - "before": "await_url https://{{nn.fqdn}}:{{serverConfig.nginxPort}}/api/.bubble 40m 20s", + "before": "await_url https://{{nn.fqdn}}:{{serverConfig.nginxPort}}/api/.bubble 10m 20s", "comment": "list DNS for the network, should now see a DNS A record for new instance", "request": { "uri": "me/networks/{{plan.name}}/dns/find?type=A&name={{{url_encoded_escaped_regex nn.fqdn}}}" diff --git a/utils/cobbzilla-wizard b/utils/cobbzilla-wizard index e3256afb..0bfd8b9c 160000 --- a/utils/cobbzilla-wizard +++ b/utils/cobbzilla-wizard @@ -1 +1 @@ -Subproject commit e3256afba721949ef4993ce7e13ec5d5ef8c2368 +Subproject commit 0bfd8b9c795011392713870f7d604c948a44b8ac