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
ca312264
Commit
ca312264
authored
Jun 19, 2015
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2270 from mitchellh/b-shell-random
provisioner/shell: randomize default script name
parents
1b691cbb
4463083a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
provisioner/shell/provisioner.go
provisioner/shell/provisioner.go
+3
-3
provisioner/shell/provisioner_test.go
provisioner/shell/provisioner_test.go
+1
-1
No files found.
provisioner/shell/provisioner.go
View file @
ca312264
...
...
@@ -9,6 +9,7 @@ import (
"io"
"io/ioutil"
"log"
"math/rand"
"os"
"strings"
"time"
...
...
@@ -19,8 +20,6 @@ import (
"github.com/mitchellh/packer/template/interpolate"
)
const
DefaultRemotePath
=
"/tmp/script.sh"
type
Config
struct
{
common
.
PackerConfig
`mapstructure:",squash"`
...
...
@@ -102,7 +101,8 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
}
if
p
.
config
.
RemotePath
==
""
{
p
.
config
.
RemotePath
=
DefaultRemotePath
p
.
config
.
RemotePath
=
fmt
.
Sprintf
(
"/tmp/script_%d.sh"
,
rand
.
Intn
(
9999
))
}
if
p
.
config
.
Scripts
==
nil
{
...
...
provisioner/shell/provisioner_test.go
View file @
ca312264
...
...
@@ -30,7 +30,7 @@ func TestProvisionerPrepare_Defaults(t *testing.T) {
t
.
Fatalf
(
"err: %s"
,
err
)
}
if
p
.
config
.
RemotePath
!=
DefaultRemotePath
{
if
p
.
config
.
RemotePath
==
""
{
t
.
Errorf
(
"unexpected remote path: %s"
,
p
.
config
.
RemotePath
)
}
}
...
...
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