Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
a3863c34
Commit
a3863c34
authored
Jun 12, 2015
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/openstack: update floating IP messaging
parent
35b8df18
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
builder/openstack/step_allocate_ip.go
builder/openstack/step_allocate_ip.go
+9
-5
No files found.
builder/openstack/step_allocate_ip.go
View file @
a3863c34
...
...
@@ -36,6 +36,8 @@ func (s *StepAllocateIp) Run(state multistep.StateBag) multistep.StepAction {
if
s
.
FloatingIp
!=
""
{
instanceIp
.
IP
=
s
.
FloatingIp
}
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
{
Pool
:
s
.
FloatingIpPool
,
})
.
Extract
()
...
...
@@ -47,22 +49,24 @@ func (s *StepAllocateIp) Run(state multistep.StateBag) multistep.StepAction {
}
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
!=
""
{
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
()
if
err
!=
nil
{
err
:=
fmt
.
Errorf
(
"Error associating floating IP %s with instance
.
"
,
instanceIp
.
IP
)
"Error associating floating IP %s with instance
: %s
"
,
instanceIp
.
IP
,
err
)
state
.
Put
(
"error"
,
err
)
ui
.
Error
(
err
.
Error
())
return
multistep
.
ActionHalt
}
ui
.
Say
(
fmt
.
Sprintf
(
"Added floating IP %s to instance
...
"
,
instanceIp
.
IP
))
ui
.
Message
(
fmt
.
Sprintf
(
"Added floating IP %s to instance
!
"
,
instanceIp
.
IP
))
}
state
.
Put
(
"access_ip"
,
&
instanceIp
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment