From 99aa33469ea6550324c4181905ec3f4e8c23b30c Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Thu, 28 May 2020 04:42:28 -0400 Subject: [PATCH] cmd/tailscale: be quiet when no interaction or errors are needed. We would print a message about "nothing more to do", which some people thought was an error or warning. Let's only print a message after authenticating if we previously asked for interaction, and let's shorten that message to just "Success," which is what it means. Signed-off-by: Avery Pennarun --- cmd/tailscale/tailscale.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd/tailscale/tailscale.go b/cmd/tailscale/tailscale.go index c503d2a51..92556fbb2 100644 --- a/cmd/tailscale/tailscale.go +++ b/cmd/tailscale/tailscale.go @@ -224,6 +224,8 @@ func runUp(ctx context.Context, args []string) error { c, bc, ctx, cancel := connect(ctx) defer cancel() + var printed bool + bc.SetPrefs(prefs) opts := ipn.Options{ StateKey: globalStateKey, @@ -235,12 +237,17 @@ func runUp(ctx context.Context, args []string) error { if s := n.State; s != nil { switch *s { case ipn.NeedsLogin: + printed = true bc.StartLoginInteractive() case ipn.NeedsMachineAuth: + printed = true fmt.Fprintf(os.Stderr, "\nTo authorize your machine, visit (as admin):\n\n\t%s/admin/machines\n\n", upArgs.server) case ipn.Starting, ipn.Running: // Done full authentication process - fmt.Fprintf(os.Stderr, "tailscaled is authenticated, nothing more to do.\n") + if printed { + // Only need to print an update if we printed the "please click" message earlier. + fmt.Fprintf(os.Stderr, "Success.\n") + } cancel() } }