mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-04 02:30:45 +00:00
Merge pull request #1588 from weaveworks/1566-fix-implicit-targets
Fix handling of implicit probe targets
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -38,6 +38,7 @@ import (
|
||||
|
||||
const (
|
||||
versionCheckPeriod = 6 * time.Hour
|
||||
defaultServiceHost = "cloud.weave.works:443"
|
||||
)
|
||||
|
||||
var pluginAPIVersion = "1"
|
||||
@@ -95,12 +96,15 @@ func probeMain(flags probeFlags) {
|
||||
go check(checkpointFlags)
|
||||
|
||||
var targets = []string{}
|
||||
if !flags.noApp {
|
||||
if flags.token != "" {
|
||||
// service mode
|
||||
if len(flag.Args()) == 0 {
|
||||
targets = append(targets, defaultServiceHost)
|
||||
}
|
||||
} else if !flags.noApp {
|
||||
targets = append(targets, fmt.Sprintf("localhost:%d", xfer.AppPort))
|
||||
}
|
||||
if len(flag.Args()) > 0 {
|
||||
targets = append(targets, flag.Args()...)
|
||||
}
|
||||
targets = append(targets, flag.Args()...)
|
||||
log.Infof("publishing to: %s", strings.Join(targets, ", "))
|
||||
|
||||
probeConfig := appclient.ProbeConfig{
|
||||
|
||||
Reference in New Issue
Block a user