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
a5ca2e5a
Commit
a5ca2e5a
authored
Nov 03, 2014
by
James Massara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use sudo only if prevent_sudo is not set
parent
347f02a7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
+14
-2
provisioner/chef-client/provisioner.go
provisioner/chef-client/provisioner.go
+14
-2
No files found.
provisioner/chef-client/provisioner.go
View file @
a5ca2e5a
...
...
@@ -338,8 +338,14 @@ func (p *Provisioner) createJson(ui packer.Ui, comm packer.Communicator) (string
func
(
p
*
Provisioner
)
createDir
(
ui
packer
.
Ui
,
comm
packer
.
Communicator
,
dir
string
)
error
{
ui
.
Message
(
fmt
.
Sprintf
(
"Creating directory: %s"
,
dir
))
mkdirCmd
:=
fmt
.
Sprintf
(
"mkdir -p '%s'"
,
dir
)
if
!
p
.
config
.
PreventSudo
{
mkdirCmd
=
"sudo "
+
mkdirCmd
}
cmd
:=
&
packer
.
RemoteCmd
{
Command
:
fmt
.
Sprintf
(
"sudo mkdir -p '%s'"
,
dir
)
,
Command
:
mkdirCmd
,
}
if
err
:=
cmd
.
StartWithUi
(
comm
,
ui
);
err
!=
nil
{
...
...
@@ -387,8 +393,14 @@ func (p *Provisioner) cleanClient(ui packer.Ui, comm packer.Communicator, node s
func
(
p
*
Provisioner
)
removeDir
(
ui
packer
.
Ui
,
comm
packer
.
Communicator
,
dir
string
)
error
{
ui
.
Message
(
fmt
.
Sprintf
(
"Removing directory: %s"
,
dir
))
rmCmd
:=
fmt
.
Sprintf
(
"rm -rf '%s'"
,
dir
)
if
!
p
.
config
.
PreventSudo
{
rmCmd
=
"sudo "
+
rmCmd
}
cmd
:=
&
packer
.
RemoteCmd
{
Command
:
fmt
.
Sprintf
(
"sudo rm -rf %s"
,
dir
)
,
Command
:
rmCmd
,
}
if
err
:=
cmd
.
StartWithUi
(
comm
,
ui
);
err
!=
nil
{
...
...
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