From 53f053ee6ff95bfc7c1097c74cc175966fd8c117 Mon Sep 17 00:00:00 2001 From: Daniel Hiltgen Date: Tue, 2 Oct 2018 10:24:16 -0700 Subject: [PATCH] Fix panic in display only case for license Prior refactoring passes missed a corner case. Signed-off-by: Daniel Hiltgen (cherry picked from commit dee37936e56c1412a6fa7b4db35a232ff7464692) Signed-off-by: Daniel Hiltgen --- cli/command/engine/activate.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cli/command/engine/activate.go b/cli/command/engine/activate.go index 34751609a6..9020d72e05 100644 --- a/cli/command/engine/activate.go +++ b/cli/command/engine/activate.go @@ -60,7 +60,7 @@ https://hub.docker.com/ then specify the file with the '--license' flag. flags.StringVar(&options.registryPrefix, "registry-prefix", clitypes.RegistryPrefix, "Override the default location where engine images are pulled") flags.StringVar(&options.image, "engine-image", "", "Specify engine image") flags.StringVar(&options.format, "format", "", "Pretty-print licenses using a Go template") - flags.BoolVar(&options.displayOnly, "display-only", false, "only display the available licenses and exit") + flags.BoolVar(&options.displayOnly, "display-only", false, "only display license information and exit") flags.BoolVar(&options.quiet, "quiet", false, "Only display available licenses by ID") flags.StringVar(&options.sockPath, "containerd", "", "override default location of containerd endpoint") @@ -90,6 +90,9 @@ func runActivate(cli command.Cli, options activateOptions) error { if license, err = getLicenses(ctx, authConfig, cli, options); err != nil { return err } + if options.displayOnly { + return nil + } } else { if license, err = licenseutils.LoadLocalIssuedLicense(ctx, options.licenseFile); err != nil { return err