Commit f3848068 authored by Jack Pearkes's avatar Jack Pearkes

post-processor/vagrant-cloud: add no_release and version_description

parent 979752cc
......@@ -17,8 +17,10 @@ const VAGRANT_CLOUD_URL = "https://vagrantcloud.com/api/v1"
type Config struct {
common.PackerConfig `mapstructure:",squash"`
Tag string `mapstructure:"box_tag"`
Version string `mapstructure:"version"`
Tag string `mapstructure:"box_tag"`
Version string `mapstructure:"version"`
VersionDescription string `mapstructure:"version_description"`
NoRelease bool `mapstructure:"no_release"`
AccessToken string `mapstructure:"access_token"`
VagrantCloudUrl string `mapstructure:"vagrant_cloud_url"`
......
......@@ -8,7 +8,8 @@ import (
type Version struct {
Version string `json:"version"`
Number uint `json:"number,omitempty"`
Description string `json:"description,omitempty"`
Number uint `json:"number,omitempty"`
}
type stepCreateVersion struct {
......@@ -29,7 +30,7 @@ func (s *stepCreateVersion) Run(state multistep.StateBag) multistep.StepAction {
path := fmt.Sprintf("box/%s/versions", box.Tag)
version := &Version{Version: config.Version}
version := &Version{Version: config.Version, Description: config.VersionDescription}
// Wrap the version in a version object for the API
wrapper := make(map[string]interface{})
......
......@@ -14,6 +14,12 @@ func (s *stepReleaseVersion) Run(state multistep.StateBag) multistep.StepAction
ui := state.Get("ui").(packer.Ui)
box := state.Get("box").(*Box)
version := state.Get("version").(*Version)
config := state.Get("config").(Config)
if config.NoRelease {
ui.Say(fmt.Sprintf("Not releasing version due to configuration: %s", version.Version))
return multistep.ActionContinue
}
path := fmt.Sprintf("box/%s/version/%v/release", box.Tag, version.Number)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment