Fix handling of implicit probe targets

Also, clean up entrypoint script.
This commit is contained in:
Alfonso Acosta
2016-06-15 10:35:41 +00:00
parent e2050e1627
commit 4dfd096ca7
3 changed files with 10 additions and 31 deletions

View File

@@ -1,14 +1,7 @@
#!/bin/bash
usage() {
echo "$0 --app.foo bar --probe.foo bar"
exit 1
}
mkdir -p /var/run/weave
TOKEN_PROVIDED=false
if [ "$1" = "version" -o "$1" = "help" ]; then
exec -a scope /home/weave/scope --mode $1
exit 0
@@ -16,34 +9,16 @@ fi
for arg in $@; do
case "$arg" in
--no-app|--probe-only)
--no-app|--probe-only|--service-token*|--probe.token*)
touch /etc/service/app/down
;;
--no-probe|--app-only)
touch /etc/service/probe/down
;;
--service-token*)
TOKEN_PROVIDED=true
touch /etc/service/app/down
;;
esac
done
echo "$@" >/var/run/weave/scope-app.args
echo "$@" >/var/run/weave/scope-probe.args
# End of the command line can optionally be some
# addresses of apps to connect to, for people not
# using Weave DNS. We stick these in /var/run/weave/apps
# for the run-probe script to pick up.
MANUAL_APPS=""
# Implicitly target the Scope Service if a service token was provided with
# no explicit manual app.
if [ "$MANUAL_APPS" = "" -a "$TOKEN_PROVIDED" = "true" ]; then
MANUAL_APPS="scope.weave.works:443"
fi
echo "$MANUAL_APPS" >/var/run/weave/apps
exec /home/weave/runsvinit

View File

@@ -1,3 +1,3 @@
#!/bin/bash
exec -a scope-probe /home/weave/scope --mode probe $(cat /var/run/weave/scope-probe.args) $(cat /var/run/weave/apps)
exec -a scope-probe /home/weave/scope --mode probe $(cat /var/run/weave/scope-probe.args)