mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-30 02:43:05 +00:00
Return stderr in tsic.Execute
This commit is contained in:
parent
6e83b7f06b
commit
e270cf6d20
1 changed files with 8 additions and 8 deletions
|
@ -110,7 +110,7 @@ func (t *TailscaleInContainer) Version() string {
|
||||||
|
|
||||||
func (t *TailscaleInContainer) Execute(
|
func (t *TailscaleInContainer) Execute(
|
||||||
command []string,
|
command []string,
|
||||||
) (string, error) {
|
) (string, string, error) {
|
||||||
log.Println("command", command)
|
log.Println("command", command)
|
||||||
log.Printf("running command for %s\n", t.hostname)
|
log.Printf("running command for %s\n", t.hostname)
|
||||||
stdout, stderr, err := dockertestutil.ExecuteCommand(
|
stdout, stderr, err := dockertestutil.ExecuteCommand(
|
||||||
|
@ -126,13 +126,13 @@ func (t *TailscaleInContainer) Execute(
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.Contains(stderr, "NeedsLogin") {
|
if strings.Contains(stderr, "NeedsLogin") {
|
||||||
return "", errTailscaleNotLoggedIn
|
return stdout, stderr, errTailscaleNotLoggedIn
|
||||||
}
|
}
|
||||||
|
|
||||||
return "", err
|
return stdout, stderr, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return stdout, nil
|
return stdout, stderr, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *TailscaleInContainer) Up(
|
func (t *TailscaleInContainer) Up(
|
||||||
|
@ -149,7 +149,7 @@ func (t *TailscaleInContainer) Up(
|
||||||
t.hostname,
|
t.hostname,
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := t.Execute(command); err != nil {
|
if _, _, err := t.Execute(command); err != nil {
|
||||||
return fmt.Errorf("failed to join tailscale client: %w", err)
|
return fmt.Errorf("failed to join tailscale client: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ func (t *TailscaleInContainer) IPs() ([]netip.Addr, error) {
|
||||||
"ip",
|
"ip",
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err := t.Execute(command)
|
result, _, err := t.Execute(command)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return []netip.Addr{}, fmt.Errorf("failed to join tailscale client: %w", err)
|
return []netip.Addr{}, fmt.Errorf("failed to join tailscale client: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ func (t *TailscaleInContainer) Status() (*ipnstate.Status, error) {
|
||||||
"--json",
|
"--json",
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err := t.Execute(command)
|
result, _, err := t.Execute(command)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to execute tailscale status command: %w", err)
|
return nil, fmt.Errorf("failed to execute tailscale status command: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -248,7 +248,7 @@ func (t *TailscaleInContainer) Ping(hostnameOrIP string) error {
|
||||||
hostnameOrIP,
|
hostnameOrIP,
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err := t.Execute(command)
|
result, _, err := t.Execute(command)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf(
|
log.Printf(
|
||||||
"failed to run ping command from %s to %s, err: %s",
|
"failed to run ping command from %s to %s, err: %s",
|
||||||
|
|
Loading…
Reference in a new issue