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 {
...
@@ -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
)
...
...
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