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
6a1d1cfb
Commit
6a1d1cfb
authored
Jul 11, 2013
by
James Van Dyke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve logging.
Correct behavior for undefined recipe list. Correct package name to upstream repo.
parent
695d3ea9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
8 deletions
+13
-8
plugin/provisioner-chef-solo/main.go
plugin/provisioner-chef-solo/main.go
+1
-1
provisioner/chef-solo/provisioner.go
provisioner/chef-solo/provisioner.go
+12
-7
No files found.
plugin/provisioner-chef-solo/main.go
View file @
6a1d1cfb
package
main
import
(
"github.com/jvandyke/packer/provisioner/chef-solo"
"github.com/mitchellh/packer/packer/plugin"
"github.com/mitchellh/packer/provisioner/chef-solo"
)
func
main
()
{
...
...
provisioner/chef-solo/provisioner.go
View file @
6a1d1cfb
...
...
@@ -149,8 +149,6 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
return
fmt
.
Errorf
(
"Error running Chef Solo: %s"
,
err
)
}
// return fmt.Errorf("Die")
return
nil
}
...
...
@@ -178,6 +176,7 @@ func UploadLocalDirectory(localDir string, comm packer.Communicator) (err error)
return
}
log
.
Printf
(
"Uploading directory %s"
,
localDir
)
err
=
filepath
.
Walk
(
localDir
,
visitPath
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"Error uploading cookbook %s: %s"
,
localDir
,
err
)
...
...
@@ -187,7 +186,8 @@ func UploadLocalDirectory(localDir string, comm packer.Communicator) (err error)
}
func
CreateRemoteDirectory
(
path
string
,
comm
packer
.
Communicator
)
(
err
error
)
{
//Ui.Say(fmt.Sprintf("Creating directory: %s", path))
log
.
Printf
(
"Creating remote directory: %s "
,
path
)
var
copyCommand
=
[]
string
{
"mkdir -p"
,
path
}
var
cmd
packer
.
RemoteCmd
...
...
@@ -211,6 +211,7 @@ func CreateSoloRb(cookbooksPaths []string, comm packer.Communicator) (str string
Ui
.
Say
(
fmt
.
Sprintf
(
"Creating Chef configuration file..."
))
remotePath
:=
RemoteStagingPath
+
"/solo.rb"
tf
,
err
:=
ioutil
.
TempFile
(
""
,
"packer-chef-solo-rb"
)
if
err
!=
nil
{
return
""
,
fmt
.
Errorf
(
"Error preparing Chef solo.rb: %s"
,
err
)
...
...
@@ -234,12 +235,13 @@ func CreateSoloRb(cookbooksPaths []string, comm packer.Communicator) (str string
name
:=
tf
.
Name
()
tf
.
Close
()
f
,
err
:=
os
.
Open
(
name
)
comm
.
Upload
(
remotePath
,
f
)
defer
os
.
Remove
(
name
)
// Upload the Chef Solo configuration file to the cookbook directory.
log
.
Printf
(
"Chef configuration file contents: %s"
,
contents
)
// Upload the Chef Solo configuration file to the cookbook directory.
log
.
Printf
(
"Uploading chef configuration file to %s"
,
remotePath
)
err
=
comm
.
Upload
(
remotePath
,
f
)
if
err
!=
nil
{
return
""
,
fmt
.
Errorf
(
"Error uploading Chef Solo configuration file: %s"
,
err
)
}
...
...
@@ -257,7 +259,10 @@ func CreateAttributesJson(jsonAttrs map[string]interface{}, recipes []string, co
}
// Add Recipes to JSON
jsonAttrs
[
"run_list"
]
=
formattedRecipes
if
len
(
formattedRecipes
)
>
0
{
log
.
Printf
(
"Overriding node run list: %s"
,
strings
.
Join
(
formattedRecipes
,
", "
))
jsonAttrs
[
"run_list"
]
=
formattedRecipes
}
// Convert to JSON string
jsonString
,
err
:=
json
.
MarshalIndent
(
jsonAttrs
,
""
,
" "
)
...
...
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