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
e4c544b3
Commit
e4c544b3
authored
Dec 05, 2014
by
Timur Batyrshin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added ssl_verify_mode parameter to chef-client provisioner
parent
e7f27432
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 @
e4c544b3
...
@@ -22,6 +22,7 @@ type Config struct {
...
@@ -22,6 +22,7 @@ type Config struct {
common
.
PackerConfig
`mapstructure:",squash"`
common
.
PackerConfig
`mapstructure:",squash"`
ChefEnvironment
string
`mapstructure:"chef_environment"`
ChefEnvironment
string
`mapstructure:"chef_environment"`
SslVerifyMode
string
`mapstructure:"ssl_verify_mode"`
ConfigTemplate
string
`mapstructure:"config_template"`
ConfigTemplate
string
`mapstructure:"config_template"`
ExecuteCommand
string
`mapstructure:"execute_command"`
ExecuteCommand
string
`mapstructure:"execute_command"`
InstallCommand
string
`mapstructure:"install_command"`
InstallCommand
string
`mapstructure:"install_command"`
...
@@ -50,6 +51,7 @@ type ConfigTemplate struct {
...
@@ -50,6 +51,7 @@ type ConfigTemplate struct {
ValidationKeyPath
string
ValidationKeyPath
string
ValidationClientName
string
ValidationClientName
string
ChefEnvironment
string
ChefEnvironment
string
SslVerifyMode
string
}
}
type
ExecuteTemplate
struct
{
type
ExecuteTemplate
struct
{
...
@@ -79,6 +81,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
...
@@ -79,6 +81,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
templates
:=
map
[
string
]
*
string
{
templates
:=
map
[
string
]
*
string
{
"chef_environment"
:
&
p
.
config
.
ChefEnvironment
,
"chef_environment"
:
&
p
.
config
.
ChefEnvironment
,
"ssl_verify_mode"
:
&
p
.
config
.
SslVerifyMode
,
"config_template"
:
&
p
.
config
.
ConfigTemplate
,
"config_template"
:
&
p
.
config
.
ConfigTemplate
,
"node_name"
:
&
p
.
config
.
NodeName
,
"node_name"
:
&
p
.
config
.
NodeName
,
"staging_dir"
:
&
p
.
config
.
StagingDir
,
"staging_dir"
:
&
p
.
config
.
StagingDir
,
...
@@ -214,7 +217,7 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
...
@@ -214,7 +217,7 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
}
}
configPath
,
err
:=
p
.
createConfig
(
configPath
,
err
:=
p
.
createConfig
(
ui
,
comm
,
nodeName
,
serverUrl
,
remoteValidationKeyPath
,
p
.
config
.
ValidationClientName
,
p
.
config
.
ChefEnvironment
)
ui
,
comm
,
nodeName
,
serverUrl
,
remoteValidationKeyPath
,
p
.
config
.
ValidationClientName
,
p
.
config
.
ChefEnvironment
,
p
.
config
.
SslVerifyMode
)
if
err
!=
nil
{
if
err
!=
nil
{
return
fmt
.
Errorf
(
"Error creating Chef config file: %s"
,
err
)
return
fmt
.
Errorf
(
"Error creating Chef config file: %s"
,
err
)
}
}
...
@@ -268,7 +271,7 @@ func (p *Provisioner) uploadDirectory(ui packer.Ui, comm packer.Communicator, ds
...
@@ -268,7 +271,7 @@ func (p *Provisioner) uploadDirectory(ui packer.Ui, comm packer.Communicator, ds
return
comm
.
UploadDir
(
dst
,
src
,
nil
)
return
comm
.
UploadDir
(
dst
,
src
,
nil
)
}
}
func
(
p
*
Provisioner
)
createConfig
(
ui
packer
.
Ui
,
comm
packer
.
Communicator
,
nodeName
string
,
serverUrl
string
,
remoteKeyPath
string
,
validationClientName
string
,
chefEnvironment
string
)
(
string
,
error
)
{
func
(
p
*
Provisioner
)
createConfig
(
ui
packer
.
Ui
,
comm
packer
.
Communicator
,
nodeName
string
,
serverUrl
string
,
remoteKeyPath
string
,
validationClientName
string
,
chefEnvironment
string
,
sslVerifyMode
string
)
(
string
,
error
)
{
ui
.
Message
(
"Creating configuration file 'client.rb'"
)
ui
.
Message
(
"Creating configuration file 'client.rb'"
)
// Read the template
// Read the template
...
@@ -294,6 +297,7 @@ func (p *Provisioner) createConfig(ui packer.Ui, comm packer.Communicator, nodeN
...
@@ -294,6 +297,7 @@ func (p *Provisioner) createConfig(ui packer.Ui, comm packer.Communicator, nodeN
ValidationKeyPath
:
remoteKeyPath
,
ValidationKeyPath
:
remoteKeyPath
,
ValidationClientName
:
validationClientName
,
ValidationClientName
:
validationClientName
,
ChefEnvironment
:
chefEnvironment
,
ChefEnvironment
:
chefEnvironment
,
SslVerifyMode
:
sslVerifyMode
,
})
})
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
err
return
""
,
err
...
@@ -574,4 +578,7 @@ node_name "{{.NodeName}}"
...
@@ -574,4 +578,7 @@ node_name "{{.NodeName}}"
{{if ne .ChefEnvironment ""}}
{{if ne .ChefEnvironment ""}}
environment "{{.ChefEnvironment}}"
environment "{{.ChefEnvironment}}"
{{end}}
{{end}}
{{if ne .SslVerifyMode ""}}
ssl_verify_mode :{{.SslVerifyMode}}
{{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