Skip to content

Commit

Permalink
Make the OpenStack builder more informative
Browse files Browse the repository at this point in the history
about the servers, images, and keypairs that it's dealing with.
  • Loading branch information
msabramo committed Dec 17, 2015
1 parent 8d57496 commit 39d6eda
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion builder/openstack/step_create_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (s *stepCreateImage) Run(state multistep.StateBag) multistep.StepAction {
state.Put("image", imageId)

// Wait for the image to become ready
ui.Say("Waiting for image to become ready...")
ui.Say(fmt.Sprintf("Waiting for image %s (image id: %s) to become ready...", config.ImageName, imageId))
if err := WaitForImage(client, imageId); err != nil {
err := fmt.Errorf("Error waiting for image: %s", err)
state.Put("error", err)
Expand Down
6 changes: 4 additions & 2 deletions builder/openstack/step_key_pair.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ func (s *StepKeyPair) Run(state multistep.StateBag) multistep.StepAction {
return multistep.ActionHalt
}

ui.Say("Creating temporary keypair for this instance...")
keyName := fmt.Sprintf("packer %s", uuid.TimeOrderedUUID())
ui.Say(fmt.Sprintf("Creating temporary keypair: %s ...", keyName))
keypair, err := keypairs.Create(computeClient, keypairs.CreateOpts{
Name: keyName,
}).Extract()
Expand All @@ -62,6 +62,8 @@ func (s *StepKeyPair) Run(state multistep.StateBag) multistep.StepAction {
return multistep.ActionHalt
}

ui.Say(fmt.Sprintf("Created temporary keypair: %s", keyName))

// If we're in debug mode, output the private key to the working
// directory.
if s.Debug {
Expand Down Expand Up @@ -120,7 +122,7 @@ func (s *StepKeyPair) Cleanup(state multistep.StateBag) {
return
}

ui.Say("Deleting temporary keypair...")
ui.Say(fmt.Sprintf("Deleting temporary keypair: %s ...", s.keyName))
err = keypairs.Delete(computeClient, s.keyName).ExtractErr()
if err != nil {
ui.Error(fmt.Sprintf(
Expand Down
2 changes: 1 addition & 1 deletion builder/openstack/step_run_source_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (s *StepRunSourceServer) Cleanup(state multistep.StateBag) {
return
}

ui.Say("Terminating the source server...")
ui.Say(fmt.Sprintf("Terminating the source server: %s ...", s.server.ID))
if err := servers.Delete(computeClient, s.server.ID).ExtractErr(); err != nil {
ui.Error(fmt.Sprintf("Error terminating server, may still be around: %s", err))
return
Expand Down
4 changes: 2 additions & 2 deletions builder/openstack/step_stop_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ func (s *StepStopServer) Run(state multistep.StateBag) multistep.StepAction {
return multistep.ActionHalt
}

ui.Say("Stopping server...")
ui.Say(fmt.Sprintf("Stopping server: %s ...", server.ID))
if err := startstop.Stop(client, server.ID).ExtractErr(); err != nil {
err = fmt.Errorf("Error stopping server: %s", err)
state.Put("error", err)
return multistep.ActionHalt
}

ui.Message("Waiting for server to stop...")
ui.Message(fmt.Sprintf("Waiting for server to stop: %s ...", server.ID))
stateChange := StateChangeConf{
Pending: []string{"ACTIVE"},
Target: []string{"SHUTOFF", "STOPPED"},
Expand Down

0 comments on commit 39d6eda

Please sign in to comment.