Skip to content

Commit e662636

Browse files
committed
cmd/tailscale: let 'tailscale up --reset' do a pref edit
The --reset shouldn't imply that a Backend.Start is necessary. With this, it can do a Backend.EditPrefs instead, which then doesn't do all the heavy work that Start does. Also, Start on Windows behaves slightly differently than Linux etc in some cases because of tailscaled running in client mode on Windows (where the GUI supplies the prefs). Fixes tailscale#3702 Change-Id: I75c9f08d5e0052bf623074030a3a7fcaa677abf6 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
1 parent 8df3fa4 commit e662636

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

cmd/tailscale/cli/cli_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,16 @@ func TestUpdatePrefs(t *testing.T) {
786786
wantSimpleUp: true,
787787
wantJustEditMP: &ipn.MaskedPrefs{WantRunningSet: true},
788788
},
789+
{
790+
name: "just_edit_reset",
791+
flags: []string{"--reset"},
792+
curPrefs: &ipn.Prefs{
793+
ControlURL: ipn.DefaultControlURL,
794+
Persist: &persist.Persist{LoginName: "crawshaw.github"},
795+
},
796+
env: upCheckEnv{backendState: "Running"},
797+
wantJustEditMP: &ipn.MaskedPrefs{WantRunningSet: true},
798+
},
789799
{
790800
name: "control_synonym",
791801
flags: []string{},

cmd/tailscale/cli/up.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,6 @@ func updatePrefs(prefs, curPrefs *ipn.Prefs, env upCheckEnv) (simpleUp bool, jus
413413

414414
justEdit := env.backendState == ipn.Running.String() &&
415415
!env.upArgs.forceReauth &&
416-
!env.upArgs.reset &&
417416
env.upArgs.authKeyOrFile == "" &&
418417
!controlURLChanged &&
419418
!tagsChanged

0 commit comments

Comments
 (0)