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
3ed73852
Commit
3ed73852
authored
Jun 11, 2015
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
provisioner/shell: set -e on the shebang itself
parent
952077cc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
provisioner/shell/provisioner.go
provisioner/shell/provisioner.go
+1
-2
website/source/docs/provisioners/shell.html.markdown
website/source/docs/provisioners/shell.html.markdown
+3
-1
No files found.
provisioner/shell/provisioner.go
View file @
3ed73852
...
@@ -94,7 +94,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
...
@@ -94,7 +94,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
}
}
if
p
.
config
.
InlineShebang
==
""
{
if
p
.
config
.
InlineShebang
==
""
{
p
.
config
.
InlineShebang
=
"/bin/sh"
p
.
config
.
InlineShebang
=
"/bin/sh
-e
"
}
}
if
p
.
config
.
RawStartRetryTimeout
==
""
{
if
p
.
config
.
RawStartRetryTimeout
==
""
{
...
@@ -184,7 +184,6 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
...
@@ -184,7 +184,6 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
// Write our contents to it
// Write our contents to it
writer
:=
bufio
.
NewWriter
(
tf
)
writer
:=
bufio
.
NewWriter
(
tf
)
writer
.
WriteString
(
fmt
.
Sprintf
(
"#!%s
\n
"
,
p
.
config
.
InlineShebang
))
writer
.
WriteString
(
fmt
.
Sprintf
(
"#!%s
\n
"
,
p
.
config
.
InlineShebang
))
writer
.
WriteString
(
"set -e
\n
"
)
for
_
,
command
:=
range
p
.
config
.
Inline
{
for
_
,
command
:=
range
p
.
config
.
Inline
{
if
_
,
err
:=
writer
.
WriteString
(
command
+
"
\n
"
);
err
!=
nil
{
if
_
,
err
:=
writer
.
WriteString
(
command
+
"
\n
"
);
err
!=
nil
{
return
fmt
.
Errorf
(
"Error preparing shell script: %s"
,
err
)
return
fmt
.
Errorf
(
"Error preparing shell script: %s"
,
err
)
...
...
website/source/docs/provisioners/shell.html.markdown
View file @
3ed73852
...
@@ -66,8 +66,10 @@ Optional parameters:
...
@@ -66,8 +66,10 @@ Optional parameters:
*
`inline_shebang`
(string) - The
*
`inline_shebang`
(string) - The
[
shebang
](
http://en.wikipedia.org/wiki/Shebang_%28Unix%29
)
value to use when
[
shebang
](
http://en.wikipedia.org/wiki/Shebang_%28Unix%29
)
value to use when
running commands specified by
`inline`
. By default, this is
`/bin/sh`
.
running commands specified by
`inline`
. By default, this is
`/bin/sh
-e
`
.
If you're not using
`inline`
, then this configuration has no effect.
If you're not using
`inline`
, then this configuration has no effect.
**Important:**
If you customize this, be sure to include something like
the
`-e`
flag, otherwise individual steps failing won't fail the provisioner.
*
`remote_path`
(string) - The path where the script will be uploaded to
*
`remote_path`
(string) - The path where the script will be uploaded to
in the machine. This defaults to "/tmp/script.sh". This value must be
in the machine. This defaults to "/tmp/script.sh". This value must be
...
...
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