Removed version.number / vagrant-cloud post-processor
A few weeks ago ... the version.number changed from an integer to a semver based string. I guess version.number and version.version are equals now. So version.version can be used. This commit should fix #1735
This commit is contained in:
parent
25441b6772
commit
277632ad99
|
@ -25,7 +25,7 @@ func (s *stepCreateProvider) Run(state multistep.StateBag) multistep.StepAction
|
|||
providerName := state.Get("providerName").(string)
|
||||
downloadUrl := state.Get("boxDownloadUrl").(string)
|
||||
|
||||
path := fmt.Sprintf("box/%s/version/%v/providers", box.Tag, version.Number)
|
||||
path := fmt.Sprintf("box/%s/version/%v/providers", box.Tag, version.Version)
|
||||
|
||||
provider := &Provider{Name: providerName}
|
||||
|
||||
|
@ -86,7 +86,7 @@ func (s *stepCreateProvider) Cleanup(state multistep.StateBag) {
|
|||
ui.Say("Cleaning up provider")
|
||||
ui.Message(fmt.Sprintf("Deleting provider: %s", s.name))
|
||||
|
||||
path := fmt.Sprintf("box/%s/version/%v/provider/%s", box.Tag, version.Number, s.name)
|
||||
path := fmt.Sprintf("box/%s/version/%v/provider/%s", box.Tag, version.Version, s.name)
|
||||
|
||||
// No need for resp from the cleanup DELETE
|
||||
_, err := client.Delete(path)
|
||||
|
|
|
@ -9,11 +9,9 @@ import (
|
|||
type Version struct {
|
||||
Version string `json:"version"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Number uint `json:"number,omitempty"`
|
||||
}
|
||||
|
||||
type stepCreateVersion struct {
|
||||
number uint // number of the version, if needed in cleanup
|
||||
}
|
||||
|
||||
func (s *stepCreateVersion) Run(state multistep.StateBag) multistep.StepAction {
|
||||
|
@ -52,9 +50,6 @@ func (s *stepCreateVersion) Run(state multistep.StateBag) multistep.StepAction {
|
|||
return multistep.ActionHalt
|
||||
}
|
||||
|
||||
// Save the number for cleanup
|
||||
s.number = version.Number
|
||||
|
||||
state.Put("version", version)
|
||||
|
||||
return multistep.ActionContinue
|
||||
|
@ -63,15 +58,8 @@ func (s *stepCreateVersion) Run(state multistep.StateBag) multistep.StepAction {
|
|||
func (s *stepCreateVersion) Cleanup(state multistep.StateBag) {
|
||||
client := state.Get("client").(*VagrantCloudClient)
|
||||
ui := state.Get("ui").(packer.Ui)
|
||||
config := state.Get("config").(Config)
|
||||
box := state.Get("box").(*Box)
|
||||
|
||||
// If we didn't save the version number, it likely doesn't exist or
|
||||
// already existed
|
||||
if s.number == 0 {
|
||||
ui.Message("Version was not created or previously existed, not deleting")
|
||||
return
|
||||
}
|
||||
version := state.Get("version").(*Version)
|
||||
|
||||
_, cancelled := state.GetOk(multistep.StateCancelled)
|
||||
_, halted := state.GetOk(multistep.StateHalted)
|
||||
|
@ -82,10 +70,10 @@ func (s *stepCreateVersion) Cleanup(state multistep.StateBag) {
|
|||
return
|
||||
}
|
||||
|
||||
path := fmt.Sprintf("box/%s/version/%v", box.Tag, s.number)
|
||||
path := fmt.Sprintf("box/%s/version/%v", box.Tag, version.Version)
|
||||
|
||||
ui.Say("Cleaning up version")
|
||||
ui.Message(fmt.Sprintf("Deleting version: %s", config.Version))
|
||||
ui.Message(fmt.Sprintf("Deleting version: %s", version.Version))
|
||||
|
||||
// No need for resp from the cleanup DELETE
|
||||
_, err := client.Delete(path)
|
||||
|
|
|
@ -22,7 +22,7 @@ func (s *stepPrepareUpload) Run(state multistep.StateBag) multistep.StepAction {
|
|||
provider := state.Get("provider").(*Provider)
|
||||
artifactFilePath := state.Get("artifactFilePath").(string)
|
||||
|
||||
path := fmt.Sprintf("box/%s/version/%v/provider/%s/upload", box.Tag, version.Number, provider.Name)
|
||||
path := fmt.Sprintf("box/%s/version/%v/provider/%s/upload", box.Tag, version.Version, provider.Name)
|
||||
upload := &Upload{}
|
||||
|
||||
ui.Say(fmt.Sprintf("Preparing upload of box: %s", artifactFilePath))
|
||||
|
|
|
@ -24,7 +24,7 @@ func (s *stepReleaseVersion) Run(state multistep.StateBag) multistep.StepAction
|
|||
return multistep.ActionContinue
|
||||
}
|
||||
|
||||
path := fmt.Sprintf("box/%s/version/%v/release", box.Tag, version.Number)
|
||||
path := fmt.Sprintf("box/%s/version/%v/release", box.Tag, version.Version)
|
||||
|
||||
resp, err := client.Put(path)
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ func (s *stepVerifyUpload) Run(state multistep.StateBag) multistep.StepAction {
|
|||
upload := state.Get("upload").(*Upload)
|
||||
provider := state.Get("provider").(*Provider)
|
||||
|
||||
path := fmt.Sprintf("box/%s/version/%v/provider/%s", box.Tag, version.Number, provider.Name)
|
||||
path := fmt.Sprintf("box/%s/version/%v/provider/%s", box.Tag, version.Version, provider.Name)
|
||||
|
||||
providerCheck := &Provider{}
|
||||
|
||||
|
|
Loading…
Reference in New Issue