return early if no set visibility
This commit is contained in:
parent
99667df17e
commit
cbe7e9113a
|
@ -15,29 +15,31 @@ func (s *stepUpdateImageVisibility) Run(state multistep.StateBag) multistep.Step
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packer.Ui)
|
||||||
config := state.Get("config").(Config)
|
config := state.Get("config").(Config)
|
||||||
|
|
||||||
if config.ImageVisibility != "" {
|
if config.ImageVisibility == "" {
|
||||||
imageClient, err := config.imageV2Client()
|
return multistep.ActionContinue
|
||||||
if err != nil {
|
}
|
||||||
err = fmt.Errorf("Error initializing image service client: %s", err)
|
imageClient, err := config.imageV2Client()
|
||||||
state.Put("error", err)
|
if err != nil {
|
||||||
return multistep.ActionHalt
|
err = fmt.Errorf("Error initializing image service client: %s", err)
|
||||||
}
|
state.Put("error", err)
|
||||||
ui.Say(fmt.Sprintf("Updating image visibility to %s", config.ImageVisibility))
|
return multistep.ActionHalt
|
||||||
r := imageservice.Update(
|
}
|
||||||
imageClient,
|
|
||||||
imageId,
|
|
||||||
imageservice.UpdateOpts{
|
|
||||||
imageservice.UpdateVisibility{
|
|
||||||
Visibility: config.ImageVisibility,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
)
|
|
||||||
if _, err = r.Extract(); err != nil {
|
|
||||||
err = fmt.Errorf("Error updating image visibility: %s", err)
|
|
||||||
state.Put("error", err)
|
|
||||||
return multistep.ActionHalt
|
|
||||||
}
|
|
||||||
|
|
||||||
|
ui.Say(fmt.Sprintf("Updating image visibility to %s", config.ImageVisibility))
|
||||||
|
r := imageservice.Update(
|
||||||
|
imageClient,
|
||||||
|
imageId,
|
||||||
|
imageservice.UpdateOpts{
|
||||||
|
imageservice.UpdateVisibility{
|
||||||
|
Visibility: config.ImageVisibility,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
if _, err = r.Extract(); err != nil {
|
||||||
|
err = fmt.Errorf("Error updating image visibility: %s", err)
|
||||||
|
state.Put("error", err)
|
||||||
|
return multistep.ActionHalt
|
||||||
}
|
}
|
||||||
|
|
||||||
return multistep.ActionContinue
|
return multistep.ActionContinue
|
||||||
|
|
Loading…
Reference in New Issue