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
5d32a1f6
Commit
5d32a1f6
authored
Jun 12, 2015
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/openstack: use IP not FixedIP
parent
590177ea
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
15 deletions
+16
-15
builder/openstack/ssh.go
builder/openstack/ssh.go
+2
-2
builder/openstack/step_allocate_ip.go
builder/openstack/step_allocate_ip.go
+14
-13
No files found.
builder/openstack/ssh.go
View file @
5d32a1f6
...
...
@@ -23,8 +23,8 @@ func SSHAddress(
// If we have a floating IP, use that
ip
:=
state
.
Get
(
"access_ip"
)
.
(
*
floatingip
.
FloatingIP
)
if
ip
!=
nil
&&
ip
.
Fixed
IP
!=
""
{
return
fmt
.
Sprintf
(
"%s:%d"
,
ip
.
Fixed
IP
,
port
),
nil
if
ip
!=
nil
&&
ip
.
IP
!=
""
{
return
fmt
.
Sprintf
(
"%s:%d"
,
ip
.
IP
,
port
),
nil
}
if
s
.
AccessIPv4
!=
""
{
...
...
builder/openstack/step_allocate_ip.go
View file @
5d32a1f6
...
...
@@ -27,13 +27,14 @@ func (s *StepAllocateIp) Run(state multistep.StateBag) multistep.StepAction {
return
multistep
.
ActionHalt
}
var
instanceIp
*
floatingip
.
FloatingIP
var
instanceIp
floatingip
.
FloatingIP
// This is here in case we error out before putting instanceIp into the
// statebag below, because it is requested by Cleanup()
state
.
Put
(
"access_ip"
,
instanceIp
)
state
.
Put
(
"access_ip"
,
&
instanceIp
)
if
s
.
FloatingIp
!=
""
{
*
instanceIp
=
floatingip
.
FloatingIP
{
FixedIP
:
s
.
FloatingIp
}
instanceIp
.
IP
=
s
.
FloatingIp
}
else
if
s
.
FloatingIpPool
!=
""
{
newIp
,
err
:=
floatingip
.
Create
(
client
,
floatingip
.
CreateOpts
{
Pool
:
s
.
FloatingIpPool
,
...
...
@@ -45,26 +46,26 @@ func (s *StepAllocateIp) Run(state multistep.StateBag) multistep.StepAction {
return
multistep
.
ActionHalt
}
*
instanceIp
=
*
newIp
ui
.
Say
(
fmt
.
Sprintf
(
"Created temporary floating IP %s..."
,
instanceIp
.
Fixed
IP
))
instanceIp
=
*
newIp
ui
.
Say
(
fmt
.
Sprintf
(
"Created temporary floating IP %s..."
,
instanceIp
.
IP
))
}
if
instanceIp
!=
nil
&&
instanceIp
.
Fixed
IP
!=
""
{
err
:=
floatingip
.
Associate
(
client
,
server
.
ID
,
instanceIp
.
Fixed
IP
)
.
ExtractErr
()
if
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
.
Fixed
IP
)
instanceIp
.
IP
)
state
.
Put
(
"error"
,
err
)
ui
.
Error
(
err
.
Error
())
return
multistep
.
ActionHalt
}
ui
.
Say
(
fmt
.
Sprintf
(
"Added floating IP %s to instance..."
,
instanceIp
.
Fixed
IP
))
"Added floating IP %s to instance..."
,
instanceIp
.
IP
))
}
state
.
Put
(
"access_ip"
,
instanceIp
)
state
.
Put
(
"access_ip"
,
&
instanceIp
)
return
multistep
.
ActionContinue
}
...
...
@@ -77,17 +78,17 @@ func (s *StepAllocateIp) Cleanup(state multistep.StateBag) {
client
,
err
:=
config
.
computeV2Client
()
if
err
!=
nil
{
ui
.
Error
(
fmt
.
Sprintf
(
"Error deleting temporary floating IP %s"
,
instanceIp
.
Fixed
IP
))
"Error deleting temporary floating IP %s"
,
instanceIp
.
IP
))
return
}
if
s
.
FloatingIpPool
!=
""
&&
instanceIp
.
ID
!=
""
{
if
err
:=
floatingip
.
Delete
(
client
,
instanceIp
.
ID
)
.
ExtractErr
();
err
!=
nil
{
ui
.
Error
(
fmt
.
Sprintf
(
"Error deleting temporary floating IP %s"
,
instanceIp
.
Fixed
IP
))
"Error deleting temporary floating IP %s"
,
instanceIp
.
IP
))
return
}
ui
.
Say
(
fmt
.
Sprintf
(
"Deleted temporary floating IP %s"
,
instanceIp
.
Fixed
IP
))
ui
.
Say
(
fmt
.
Sprintf
(
"Deleted temporary floating IP %s"
,
instanceIp
.
IP
))
}
}
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