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
a95408aa
Commit
a95408aa
authored
Jun 15, 2015
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2224 from mitchellh/f-os-userdata
builder/openstack: support user data [GH-1867]
parents
3edff006
b3a97124
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
0 deletions
+18
-0
builder/openstack/builder.go
builder/openstack/builder.go
+2
-0
builder/openstack/run_config.go
builder/openstack/run_config.go
+2
-0
builder/openstack/step_run_source_server.go
builder/openstack/step_run_source_server.go
+14
-0
No files found.
builder/openstack/builder.go
View file @
a95408aa
...
@@ -83,6 +83,8 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
...
@@ -83,6 +83,8 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
SecurityGroups
:
b
.
config
.
SecurityGroups
,
SecurityGroups
:
b
.
config
.
SecurityGroups
,
Networks
:
b
.
config
.
Networks
,
Networks
:
b
.
config
.
Networks
,
AvailabilityZone
:
b
.
config
.
AvailabilityZone
,
AvailabilityZone
:
b
.
config
.
AvailabilityZone
,
UserData
:
b
.
config
.
UserData
,
UserDataFile
:
b
.
config
.
UserDataFile
,
},
},
&
StepWaitForRackConnect
{
&
StepWaitForRackConnect
{
Wait
:
b
.
config
.
RackconnectWait
,
Wait
:
b
.
config
.
RackconnectWait
,
...
...
builder/openstack/run_config.go
View file @
a95408aa
...
@@ -21,6 +21,8 @@ type RunConfig struct {
...
@@ -21,6 +21,8 @@ type RunConfig struct {
FloatingIp
string
`mapstructure:"floating_ip"`
FloatingIp
string
`mapstructure:"floating_ip"`
SecurityGroups
[]
string
`mapstructure:"security_groups"`
SecurityGroups
[]
string
`mapstructure:"security_groups"`
Networks
[]
string
`mapstructure:"networks"`
Networks
[]
string
`mapstructure:"networks"`
UserData
string
`mapstructure:"user_data"`
UserDataFile
string
`mapstructure:"user_data_file"`
// Not really used, but here for BC
// Not really used, but here for BC
OpenstackProvider
string
`mapstructure:"openstack_provider"`
OpenstackProvider
string
`mapstructure:"openstack_provider"`
...
...
builder/openstack/step_run_source_server.go
View file @
a95408aa
...
@@ -2,6 +2,7 @@ package openstack
...
@@ -2,6 +2,7 @@ package openstack
import
(
import
(
"fmt"
"fmt"
"io/ioutil"
"log"
"log"
"github.com/mitchellh/multistep"
"github.com/mitchellh/multistep"
...
@@ -16,6 +17,8 @@ type StepRunSourceServer struct {
...
@@ -16,6 +17,8 @@ type StepRunSourceServer struct {
SecurityGroups
[]
string
SecurityGroups
[]
string
Networks
[]
string
Networks
[]
string
AvailabilityZone
string
AvailabilityZone
string
UserData
string
UserDataFile
string
server
*
servers
.
Server
server
*
servers
.
Server
}
}
...
@@ -39,6 +42,16 @@ func (s *StepRunSourceServer) Run(state multistep.StateBag) multistep.StepAction
...
@@ -39,6 +42,16 @@ func (s *StepRunSourceServer) Run(state multistep.StateBag) multistep.StepAction
networks
[
i
]
.
UUID
=
networkUuid
networks
[
i
]
.
UUID
=
networkUuid
}
}
userData
:=
[]
byte
(
s
.
UserData
)
if
s
.
UserDataFile
!=
""
{
userData
,
err
=
ioutil
.
ReadFile
(
s
.
UserDataFile
)
if
err
!=
nil
{
err
=
fmt
.
Errorf
(
"Error reading user data file: %s"
,
err
)
state
.
Put
(
"error"
,
err
)
return
multistep
.
ActionHalt
}
}
ui
.
Say
(
"Launching server..."
)
ui
.
Say
(
"Launching server..."
)
s
.
server
,
err
=
servers
.
Create
(
computeClient
,
keypairs
.
CreateOptsExt
{
s
.
server
,
err
=
servers
.
Create
(
computeClient
,
keypairs
.
CreateOptsExt
{
CreateOptsBuilder
:
servers
.
CreateOpts
{
CreateOptsBuilder
:
servers
.
CreateOpts
{
...
@@ -48,6 +61,7 @@ func (s *StepRunSourceServer) Run(state multistep.StateBag) multistep.StepAction
...
@@ -48,6 +61,7 @@ func (s *StepRunSourceServer) Run(state multistep.StateBag) multistep.StepAction
SecurityGroups
:
s
.
SecurityGroups
,
SecurityGroups
:
s
.
SecurityGroups
,
Networks
:
networks
,
Networks
:
networks
,
AvailabilityZone
:
s
.
AvailabilityZone
,
AvailabilityZone
:
s
.
AvailabilityZone
,
UserData
:
userData
,
},
},
KeyName
:
keyName
,
KeyName
:
keyName
,
...
...
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