mirror of
https://github.com/juanfont/headscale.git
synced 2025-01-19 10:20:05 +09:00
more debug logging for logout
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
parent
95c7450b00
commit
cbd8066757
1 changed files with 7 additions and 3 deletions
|
@ -475,14 +475,18 @@ func (t *TailscaleInContainer) LoginWithURL(
|
||||||
"--accept-routes=false",
|
"--accept-routes=false",
|
||||||
}
|
}
|
||||||
|
|
||||||
_, stderr, err := t.Execute(command)
|
stdout, stderr, err := t.Execute(command)
|
||||||
if errors.Is(err, errTailscaleNotLoggedIn) {
|
if errors.Is(err, errTailscaleNotLoggedIn) {
|
||||||
return nil, errTailscaleCannotUpWithoutAuthkey
|
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)
|
urlStr = strings.TrimSpace(urlStr)
|
||||||
|
|
||||||
|
if urlStr == "" {
|
||||||
|
return nil, fmt.Errorf("failed to get login URL: stdout: %s, stderr: %s", stdout, stderr)
|
||||||
|
}
|
||||||
|
|
||||||
// parse URL
|
// parse URL
|
||||||
loginURL, err := url.Parse(urlStr)
|
loginURL, err := url.Parse(urlStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -497,7 +501,7 @@ func (t *TailscaleInContainer) LoginWithURL(
|
||||||
|
|
||||||
// Logout runs the logout routine on the given Tailscale instance.
|
// Logout runs the logout routine on the given Tailscale instance.
|
||||||
func (t *TailscaleInContainer) Logout() error {
|
func (t *TailscaleInContainer) Logout() error {
|
||||||
_, _, err := t.Execute([]string{"tailscale", "logout"})
|
stdout, stderr, err := t.Execute([]string{"tailscale", "logout"})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue