Commit a3863c34 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

builder/openstack: update floating IP messaging

parent 35b8df18
...@@ -36,6 +36,8 @@ func (s *StepAllocateIp) Run(state multistep.StateBag) multistep.StepAction { ...@@ -36,6 +36,8 @@ func (s *StepAllocateIp) Run(state multistep.StateBag) multistep.StepAction {
if s.FloatingIp != "" { if s.FloatingIp != "" {
instanceIp.IP = s.FloatingIp instanceIp.IP = s.FloatingIp
} else if s.FloatingIpPool != "" { } else if s.FloatingIpPool != "" {
ui.Say(fmt.Sprintf("Creating floating IP..."))
ui.Message(fmt.Sprintf("Pool: %s", s.FloatingIpPool))
newIp, err := floatingip.Create(client, floatingip.CreateOpts{ newIp, err := floatingip.Create(client, floatingip.CreateOpts{
Pool: s.FloatingIpPool, Pool: s.FloatingIpPool,
}).Extract() }).Extract()
...@@ -47,22 +49,24 @@ func (s *StepAllocateIp) Run(state multistep.StateBag) multistep.StepAction { ...@@ -47,22 +49,24 @@ func (s *StepAllocateIp) Run(state multistep.StateBag) multistep.StepAction {
} }
instanceIp = *newIp instanceIp = *newIp
ui.Say(fmt.Sprintf("Created temporary floating IP %s...", instanceIp.IP)) ui.Message(fmt.Sprintf("Created floating IP: %s", instanceIp.IP))
} }
if instanceIp.IP != "" { if instanceIp.IP != "" {
ui.Say(fmt.Sprintf("Associating floating IP with server..."))
ui.Message(fmt.Sprintf("IP: %s", instanceIp.IP))
err := floatingip.Associate(client, server.ID, instanceIp.IP).ExtractErr() err := floatingip.Associate(client, server.ID, instanceIp.IP).ExtractErr()
if err != nil { if err != nil {
err := fmt.Errorf( err := fmt.Errorf(
"Error associating floating IP %s with instance.", "Error associating floating IP %s with instance: %s",
instanceIp.IP) instanceIp.IP, err)
state.Put("error", err) state.Put("error", err)
ui.Error(err.Error()) ui.Error(err.Error())
return multistep.ActionHalt return multistep.ActionHalt
} }
ui.Say(fmt.Sprintf( ui.Message(fmt.Sprintf(
"Added floating IP %s to instance...", instanceIp.IP)) "Added floating IP %s to instance!", instanceIp.IP))
} }
state.Put("access_ip", &instanceIp) state.Put("access_ip", &instanceIp)
......
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