From 3dfdef4d39938478ebf1193c83433e92de36e5b6 Mon Sep 17 00:00:00 2001 From: Chris Bednarski Date: Tue, 27 Oct 2015 18:30:58 -0700 Subject: [PATCH 1/4] Removed push -m since this is not used --- command/push.go | 9 --------- 1 file changed, 9 deletions(-) diff --git a/command/push.go b/command/push.go index dac5aa180..4100282dd 100644 --- a/command/push.go +++ b/command/push.go @@ -38,15 +38,12 @@ type pushUploadFn func( func (c *PushCommand) Run(args []string) int { var token string - var message string var name string var create bool f := c.Meta.FlagSet("push", FlagSetVars) f.Usage = func() { c.Ui.Error(c.Help()) } f.StringVar(&token, "token", "", "token") - f.StringVar(&message, "m", "", "message") - f.StringVar(&message, "message", "", "message") f.StringVar(&name, "name", "", "name") f.BoolVar(&create, "create", false, "create (deprecated)") if err := f.Parse(args); err != nil { @@ -186,9 +183,6 @@ func (c *PushCommand) Run(args []string) int { // Add the upload metadata metadata := make(map[string]interface{}) - if message != "" { - metadata["message"] = message - } metadata["template"] = tpl.RawContents metadata["template_name"] = filepath.Base(args[0]) uploadOpts.Metadata = metadata @@ -268,9 +262,6 @@ Usage: packer push [options] TEMPLATE Options: - -m, -message= A message to identify the purpose or changes in this - Packer template much like a VCS commit message - -name= The destination build in Atlas. This is in a format "username/name". From 0e9cd5caa9f7c26c44ed38c079c09f8ae6b6655a Mon Sep 17 00:00:00 2001 From: Chris Bednarski Date: Tue, 27 Oct 2015 18:35:37 -0700 Subject: [PATCH 2/4] Remove push -m from the docs --- website/source/docs/command-line/push.html.markdown | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/website/source/docs/command-line/push.html.markdown b/website/source/docs/command-line/push.html.markdown index 57ea58cf0..003f52c12 100644 --- a/website/source/docs/command-line/push.html.markdown +++ b/website/source/docs/command-line/push.html.markdown @@ -34,10 +34,6 @@ configuration using the options below. ## Options -- `-message` - A message to identify the purpose or changes in this Packer - template much like a VCS commit message. This message will be passed to the - Packer build service. This option is also available as a short option `-m`. - - `-token` - Your access token for the Atlas API. -> Login to Atlas to [generate an Atlas @@ -59,7 +55,7 @@ you can also use `-token` on the command line. Push a Packer template: ``` {.shell} -$ packer push -m "Updating the apache version" template.json +$ packer push template.json ``` Push a Packer template with a custom token: From 5e348644949250efb72bf3b8d88a588a6fd9d340 Mon Sep 17 00:00:00 2001 From: Chris Bednarski Date: Tue, 27 Oct 2015 18:35:57 -0700 Subject: [PATCH 3/4] Add deprecation notice for -m/-message --- command/push.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/command/push.go b/command/push.go index 4100282dd..b9ce96769 100644 --- a/command/push.go +++ b/command/push.go @@ -3,6 +3,7 @@ package command import ( "fmt" "io" + "log" "os" "os/signal" "path/filepath" @@ -38,18 +39,25 @@ type pushUploadFn func( func (c *PushCommand) Run(args []string) int { var token string + var message string var name string var create bool f := c.Meta.FlagSet("push", FlagSetVars) f.Usage = func() { c.Ui.Error(c.Help()) } f.StringVar(&token, "token", "", "token") + f.StringVar(&message, "m", "", "message") + f.StringVar(&message, "message", "", "message") f.StringVar(&name, "name", "", "name") f.BoolVar(&create, "create", false, "create (deprecated)") if err := f.Parse(args); err != nil { return 1 } + if message != "" { + log.Printf("[WARN] -m/-message is deprecated and will be removed in a future Packer release") + } + args = f.Args() if len(args) != 1 { f.Usage() From d8953e48d4f9c3064917925dc2852802d118f05e Mon Sep 17 00:00:00 2001 From: Chris Bednarski Date: Thu, 14 Jan 2016 17:18:02 -0800 Subject: [PATCH 4/4] Change log to Ui.Warn and restore the removed functionality for now --- command/push.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/command/push.go b/command/push.go index b9ce96769..614f800aa 100644 --- a/command/push.go +++ b/command/push.go @@ -3,7 +3,6 @@ package command import ( "fmt" "io" - "log" "os" "os/signal" "path/filepath" @@ -55,7 +54,7 @@ func (c *PushCommand) Run(args []string) int { } if message != "" { - log.Printf("[WARN] -m/-message is deprecated and will be removed in a future Packer release") + c.Ui.Warn("[DEPRECATED] -m/-message is deprecated and will be removed in a future Packer release") } args = f.Args() @@ -191,6 +190,9 @@ func (c *PushCommand) Run(args []string) int { // Add the upload metadata metadata := make(map[string]interface{}) + if message != "" { + metadata["message"] = message + } metadata["template"] = tpl.RawContents metadata["template_name"] = filepath.Base(args[0]) uploadOpts.Metadata = metadata