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
b2d5b151
Commit
b2d5b151
authored
Sep 18, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fmt
parent
129f1290
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
13 deletions
+13
-13
provisioner/chef-solo/provisioner.go
provisioner/chef-solo/provisioner.go
+12
-12
provisioner/chef-solo/provisioner_test.go
provisioner/chef-solo/provisioner_test.go
+1
-1
No files found.
provisioner/chef-solo/provisioner.go
View file @
b2d5b151
...
...
@@ -20,8 +20,8 @@ type Config struct {
ConfigTemplate
string
`mapstructure:"config_template"`
CookbookPaths
[]
string
`mapstructure:"cookbook_paths"`
RolesPath
string
`mapstructure:"roles_path"`
DataBagsPath
string
`mapstructure:"data_bags_path"`
RolesPath
string
`mapstructure:"roles_path"`
DataBagsPath
string
`mapstructure:"data_bags_path"`
ExecuteCommand
string
`mapstructure:"execute_command"`
InstallCommand
string
`mapstructure:"install_command"`
RemoteCookbookPaths
[]
string
`mapstructure:"remote_cookbook_paths"`
...
...
@@ -39,9 +39,9 @@ type Provisioner struct {
}
type
ConfigTemplate
struct
{
CookbookPaths
string
RolesPath
string
DataBagsPath
string
CookbookPaths
string
RolesPath
string
DataBagsPath
string
}
type
ExecuteTemplate
struct
{
...
...
@@ -147,10 +147,10 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
errs
,
fmt
.
Errorf
(
"Bad cookbook path '%s': %s"
,
path
,
err
))
}
}
if
p
.
config
.
RolesPath
!=
""
{
pFileInfo
,
err
:=
os
.
Stat
(
p
.
config
.
RolesPath
)
if
err
!=
nil
||
!
pFileInfo
.
IsDir
()
{
errs
=
packer
.
MultiErrorAppend
(
errs
,
fmt
.
Errorf
(
"Bad roles path '%s': %s"
,
p
.
config
.
RolesPath
,
err
))
...
...
@@ -159,7 +159,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
if
p
.
config
.
DataBagsPath
!=
""
{
pFileInfo
,
err
:=
os
.
Stat
(
p
.
config
.
DataBagsPath
)
if
err
!=
nil
||
!
pFileInfo
.
IsDir
()
{
errs
=
packer
.
MultiErrorAppend
(
errs
,
fmt
.
Errorf
(
"Bad data bags path '%s': %s"
,
p
.
config
.
DataBagsPath
,
err
))
...
...
@@ -201,7 +201,7 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
cookbookPaths
=
append
(
cookbookPaths
,
targetPath
)
}
rolesPath
:=
""
if
p
.
config
.
RolesPath
!=
""
{
rolesPath
:=
fmt
.
Sprintf
(
"%s/roles"
,
p
.
config
.
StagingDir
)
...
...
@@ -267,7 +267,7 @@ func (p *Provisioner) createConfig(ui packer.Ui, comm packer.Communicator, local
i
=
len
(
p
.
config
.
RemoteCookbookPaths
)
+
i
cookbook_paths
[
i
]
=
fmt
.
Sprintf
(
`"%s"`
,
path
)
}
roles_path
:=
""
if
rolesPath
!=
""
{
roles_path
=
fmt
.
Sprintf
(
`"%s"`
,
rolesPath
)
...
...
@@ -297,8 +297,8 @@ func (p *Provisioner) createConfig(ui packer.Ui, comm packer.Communicator, local
configString
,
err
:=
p
.
config
.
tpl
.
Process
(
tpl
,
&
ConfigTemplate
{
CookbookPaths
:
strings
.
Join
(
cookbook_paths
,
","
),
RolesPath
:
roles_path
,
DataBagsPath
:
data_bags_path
,
RolesPath
:
roles_path
,
DataBagsPath
:
data_bags_path
,
})
if
err
!=
nil
{
return
""
,
err
...
...
provisioner/chef-solo/provisioner_test.go
View file @
b2d5b151
...
...
@@ -107,7 +107,7 @@ func TestProvisionerPrepare_cookbookPaths(t *testing.T) {
if
p
.
config
.
CookbookPaths
[
0
]
!=
path1
||
p
.
config
.
CookbookPaths
[
1
]
!=
path2
{
t
.
Fatalf
(
"unexpected: %#v"
,
p
.
config
.
CookbookPaths
)
}
if
p
.
config
.
RolesPath
!=
rolesPath
{
t
.
Fatalf
(
"unexpected: %#v"
,
p
.
config
.
RolesPath
)
}
...
...
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