From cbd80667570e25832ac1a2c6b12efb6ea3d738c5 Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Mon, 13 Jan 2025 11:47:51 +0100 Subject: [PATCH] more debug logging for logout Signed-off-by: Kristoffer Dalby --- integration/tsic/tsic.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/integration/tsic/tsic.go b/integration/tsic/tsic.go index e63a7b6e..046878b7 100644 --- a/integration/tsic/tsic.go +++ b/integration/tsic/tsic.go @@ -475,14 +475,18 @@ func (t *TailscaleInContainer) LoginWithURL( "--accept-routes=false", } - _, stderr, err := t.Execute(command) + stdout, stderr, err := t.Execute(command) if errors.Is(err, errTailscaleNotLoggedIn) { return nil, errTailscaleCannotUpWithoutAuthkey } - urlStr := strings.ReplaceAll(stderr, "\nTo authenticate, visit:\n\n\t", "") + urlStr := strings.ReplaceAll(stdout+stderr, "\nTo authenticate, visit:\n\n\t", "") urlStr = strings.TrimSpace(urlStr) + if urlStr == "" { + return nil, fmt.Errorf("failed to get login URL: stdout: %s, stderr: %s", stdout, stderr) + } + // parse URL loginURL, err := url.Parse(urlStr) if err != nil { @@ -497,7 +501,7 @@ func (t *TailscaleInContainer) LoginWithURL( // Logout runs the logout routine on the given Tailscale instance. func (t *TailscaleInContainer) Logout() error { - _, _, err := t.Execute([]string{"tailscale", "logout"}) + stdout, stderr, err := t.Execute([]string{"tailscale", "logout"}) if err != nil { return err }