tsnet: do not error on NeedsMachineAuth for Up

It turns out even with an AuthKey that pre-approves devices on a tailnet
with machine auth turned on, we still temporarily see the
NeedsMachineAuth state. So remove that error (for now).

Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
pull/7405/head
David Crawshaw 2 years ago committed by David Crawshaw
parent 768df4ff7a
commit d41f6a8752

@ -233,8 +233,7 @@ func (s *Server) Up(ctx context.Context) (*ipnstate.Status, error) {
return nil, fmt.Errorf("tsnet.Up: backend: %s", *n.ErrMessage) return nil, fmt.Errorf("tsnet.Up: backend: %s", *n.ErrMessage)
} }
if s := n.State; s != nil { if s := n.State; s != nil {
switch *s { if *s == ipn.Running {
case ipn.Running:
status, err := lc.Status(ctx) status, err := lc.Status(ctx)
if err != nil { if err != nil {
return nil, fmt.Errorf("tsnet.Up: %w", err) return nil, fmt.Errorf("tsnet.Up: %w", err)
@ -243,15 +242,13 @@ func (s *Server) Up(ctx context.Context) (*ipnstate.Status, error) {
return nil, errors.New("tsnet.Up: running, but no ip") return nil, errors.New("tsnet.Up: running, but no ip")
} }
return status, nil return status, nil
case ipn.NeedsMachineAuth:
return nil, errors.New("tsnet.Up: tailnet requested machine auth")
} }
// TODO: in the future, return an error on NeedsLogin // TODO: in the future, return an error on ipn.NeedsLogin
// to improve the UX of trying out the tsnet package. // and ipn.NeedsMachineAuth to improve the UX of trying
// out the tsnet package.
// //
// Unfortunately today, even when using an AuthKey we // Unfortunately today, even when using an AuthKey we
// briefly see a NeedsLogin state. It would be nice // briefly see these states. It would be nice to fix.
// to fix that.
} }
} }
} }

Loading…
Cancel
Save