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
eb4ba76e
Commit
eb4ba76e
authored
Apr 24, 2014
by
James Cline
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
provisioner/chef-client: validation_client_name
Allows setting of validation_client_name from packer template json.
parent
8dcabe97
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
provisioner/chef-client/provisioner.go
provisioner/chef-client/provisioner.go
+9
-2
No files found.
provisioner/chef-client/provisioner.go
View file @
eb4ba76e
...
...
@@ -33,6 +33,7 @@ type Config struct {
SkipInstall
bool
`mapstructure:"skip_install"`
StagingDir
string
`mapstructure:"staging_directory"`
ValidationKeyPath
string
`mapstructure:"validation_key_path"`
ValidationClientName
string
`mapstructure:"validation_client_name"`
tpl
*
packer
.
ConfigTemplate
}
...
...
@@ -45,6 +46,7 @@ type ConfigTemplate struct {
NodeName
string
ServerUrl
string
ValidationKeyPath
string
ValidationClientName
string
}
type
ExecuteTemplate
struct
{
...
...
@@ -188,7 +190,7 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
}
configPath
,
err
:=
p
.
createConfig
(
ui
,
comm
,
nodeName
,
serverUrl
,
remoteValidationKeyPath
)
ui
,
comm
,
nodeName
,
serverUrl
,
remoteValidationKeyPath
,
p
.
config
.
ValidationClientName
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"Error creating Chef config file: %s"
,
err
)
}
...
...
@@ -242,7 +244,7 @@ func (p *Provisioner) uploadDirectory(ui packer.Ui, comm packer.Communicator, ds
return
comm
.
UploadDir
(
dst
,
src
,
nil
)
}
func
(
p
*
Provisioner
)
createConfig
(
ui
packer
.
Ui
,
comm
packer
.
Communicator
,
nodeName
string
,
serverUrl
string
,
remoteKeyPath
string
)
(
string
,
error
)
{
func
(
p
*
Provisioner
)
createConfig
(
ui
packer
.
Ui
,
comm
packer
.
Communicator
,
nodeName
string
,
serverUrl
string
,
remoteKeyPath
string
,
validationClientName
string
)
(
string
,
error
)
{
ui
.
Message
(
"Creating configuration file 'client.rb'"
)
// Read the template
...
...
@@ -266,6 +268,7 @@ func (p *Provisioner) createConfig(ui packer.Ui, comm packer.Communicator, nodeN
NodeName
:
nodeName
,
ServerUrl
:
serverUrl
,
ValidationKeyPath
:
remoteKeyPath
,
ValidationClientName
:
validationClientName
,
})
if
err
!=
nil
{
return
""
,
err
...
...
@@ -481,7 +484,11 @@ var DefaultConfigTemplate = `
log_level :info
log_location STDOUT
chef_server_url "{{.ServerUrl}}"
{{if ne .ValidationClientName ""}}
validation_client_name "{{.ValidationClientName}}"
{{else}}
validation_client_name "chef-validator"
{{end}}
{{if ne .ValidationKeyPath ""}}
validation_key "{{.ValidationKeyPath}}"
{{end}}
...
...
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