builder/openstack: new multistep API

This commit is contained in:
Mitchell Hashimoto
2013-08-31 12:37:07 -07:00
parent a82f1c18ee
commit ea5361a9ac
6 changed files with 45 additions and 44 deletions
+7 -7
View File
@@ -72,11 +72,11 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
}
// Setup the state bag and initial state for the steps
state := make(map[string]interface{})
state["config"] = b.config
state["csp"] = csp
state["hook"] = hook
state["ui"] = ui
state := new(multistep.BasicStateBag)
state.Put("config", b.config)
state.Put("csp", csp)
state.Put("hook", hook)
state.Put("ui", ui)
// Build the steps
steps := []multistep.Step{
@@ -108,13 +108,13 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
b.runner.Run(state)
// If there was an error, return that
if rawErr, ok := state["error"]; ok {
if rawErr, ok := state.GetOk("error"); ok {
return nil, rawErr.(error)
}
// Build the artifact and return it
artifact := &Artifact{
ImageId: state["image"].(string),
ImageId: state.Get("image").(string),
BuilderIdValue: BuilderId,
Conn: csp,
}