mirror of
https://github.com/juanfont/headscale.git
synced 2025-09-02 13:47:00 +02:00
integration/tsic: fix diff in login commands
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
parent
74b4f7f259
commit
0b3d77a8f6
@ -426,20 +426,21 @@ func (t *TailscaleInContainer) Logs(stdout, stderr io.Writer) error {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Up runs the login routine on the given Tailscale instance.
|
func (t *TailscaleInContainer) buildLoginCommand(
|
||||||
// This login mechanism uses the authorised key for authentication.
|
|
||||||
func (t *TailscaleInContainer) Login(
|
|
||||||
loginServer, authKey string,
|
loginServer, authKey string,
|
||||||
) error {
|
) []string {
|
||||||
command := []string{
|
command := []string{
|
||||||
"tailscale",
|
"tailscale",
|
||||||
"up",
|
"up",
|
||||||
"--login-server=" + loginServer,
|
"--login-server=" + loginServer,
|
||||||
"--authkey=" + authKey,
|
|
||||||
"--hostname=" + t.hostname,
|
"--hostname=" + t.hostname,
|
||||||
fmt.Sprintf("--accept-routes=%t", t.withAcceptRoutes),
|
fmt.Sprintf("--accept-routes=%t", t.withAcceptRoutes),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if authKey != "" {
|
||||||
|
command = append(command, "--authkey="+authKey)
|
||||||
|
}
|
||||||
|
|
||||||
if t.extraLoginArgs != nil {
|
if t.extraLoginArgs != nil {
|
||||||
command = append(command, t.extraLoginArgs...)
|
command = append(command, t.extraLoginArgs...)
|
||||||
}
|
}
|
||||||
@ -458,6 +459,16 @@ func (t *TailscaleInContainer) Login(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return command
|
||||||
|
}
|
||||||
|
|
||||||
|
// Login runs the login routine on the given Tailscale instance.
|
||||||
|
// This login mechanism uses the authorised key for authentication.
|
||||||
|
func (t *TailscaleInContainer) Login(
|
||||||
|
loginServer, authKey string,
|
||||||
|
) error {
|
||||||
|
command := t.buildLoginCommand(loginServer, authKey)
|
||||||
|
|
||||||
if _, _, err := t.Execute(command, dockertestutil.ExecuteCommandTimeout(dockerExecuteTimeout)); err != nil {
|
if _, _, err := t.Execute(command, dockertestutil.ExecuteCommandTimeout(dockerExecuteTimeout)); err != nil {
|
||||||
return fmt.Errorf(
|
return fmt.Errorf(
|
||||||
"%s failed to join tailscale client (%s): %w",
|
"%s failed to join tailscale client (%s): %w",
|
||||||
@ -475,17 +486,7 @@ func (t *TailscaleInContainer) Login(
|
|||||||
func (t *TailscaleInContainer) LoginWithURL(
|
func (t *TailscaleInContainer) LoginWithURL(
|
||||||
loginServer string,
|
loginServer string,
|
||||||
) (loginURL *url.URL, err error) {
|
) (loginURL *url.URL, err error) {
|
||||||
command := []string{
|
command := t.buildLoginCommand(loginServer, "")
|
||||||
"tailscale",
|
|
||||||
"up",
|
|
||||||
"--login-server=" + loginServer,
|
|
||||||
"--hostname=" + t.hostname,
|
|
||||||
"--accept-routes=false",
|
|
||||||
}
|
|
||||||
|
|
||||||
if t.extraLoginArgs != nil {
|
|
||||||
command = append(command, t.extraLoginArgs...)
|
|
||||||
}
|
|
||||||
|
|
||||||
stdout, stderr, err := t.Execute(command)
|
stdout, stderr, err := t.Execute(command)
|
||||||
if errors.Is(err, errTailscaleNotLoggedIn) {
|
if errors.Is(err, errTailscaleNotLoggedIn) {
|
||||||
|
Loading…
Reference in New Issue
Block a user