clientupdate: add explicit Track to Arguments (#10548)

Instead of overloading the Version field, add an explicit Track field.

This fixes a bug where passing a track name in `args.Version` would keep
the track name in `updater.Version` and pass it down the code path to
commands like `apt-get install`. Now, `updater.Version` should always be
a version (or empty string).

Updates #cleanup

Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
This commit is contained in:
Andrew Lytvynov
2023-12-11 11:20:42 -06:00
committed by GitHub
parent 1b1b6bb634
commit d8493d4bd5
2 changed files with 46 additions and 40 deletions

View File

@@ -59,12 +59,9 @@ func runUpdate(ctx context.Context, args []string) error {
if updateArgs.version != "" && updateArgs.track != "" {
return errors.New("cannot specify both --version and --track")
}
ver := updateArgs.version
if updateArgs.track != "" {
ver = updateArgs.track
}
err := clientupdate.Update(clientupdate.Arguments{
Version: ver,
Version: updateArgs.version,
Track: updateArgs.track,
Logf: func(f string, a ...any) { printf(f+"\n", a...) },
Stdout: Stdout,
Stderr: Stderr,