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
17d0f5f7
Commit
17d0f5f7
authored
Jun 27, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
provisioner/shell: rename "path" to "script"
parent
3cd02297
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
provisioner/shell/provisioner.go
provisioner/shell/provisioner.go
+5
-5
provisioner/shell/provisioner_test.go
provisioner/shell/provisioner_test.go
+7
-7
No files found.
provisioner/shell/provisioner.go
View file @
17d0f5f7
...
...
@@ -26,7 +26,7 @@ type config struct {
Inline
[]
string
// The local path of the shell script to upload and execute.
Path
string
Script
string
// An array of multiple scripts to run.
Scripts
[]
string
...
...
@@ -73,12 +73,12 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
errs
:=
make
([]
error
,
0
)
if
p
.
config
.
Path
!=
""
&&
len
(
p
.
config
.
Scripts
)
>
0
{
errs
=
append
(
errs
,
errors
.
New
(
"Only one of
path
or scripts can be specified."
))
if
p
.
config
.
Script
!=
""
&&
len
(
p
.
config
.
Scripts
)
>
0
{
errs
=
append
(
errs
,
errors
.
New
(
"Only one of
script
or scripts can be specified."
))
}
if
p
.
config
.
Path
!=
""
{
p
.
config
.
Scripts
=
[]
string
{
p
.
config
.
Path
}
if
p
.
config
.
Script
!=
""
{
p
.
config
.
Scripts
=
[]
string
{
p
.
config
.
Script
}
}
if
len
(
p
.
config
.
Scripts
)
==
0
&&
p
.
config
.
Inline
==
nil
{
...
...
provisioner/shell/provisioner_test.go
View file @
17d0f5f7
...
...
@@ -35,11 +35,11 @@ func TestProvisionerPrepare_Defaults(t *testing.T) {
}
}
func
TestProvisionerPrepare_
Path
(
t
*
testing
.
T
)
{
func
TestProvisionerPrepare_
Script
(
t
*
testing
.
T
)
{
config
:=
testConfig
()
delete
(
config
,
"inline"
)
config
[
"
path
"
]
=
"/this/should/not/exist"
config
[
"
script
"
]
=
"/this/should/not/exist"
p
:=
new
(
Provisioner
)
err
:=
p
.
Prepare
(
config
)
if
err
==
nil
{
...
...
@@ -53,7 +53,7 @@ func TestProvisionerPrepare_Path(t *testing.T) {
}
defer
os
.
Remove
(
tf
.
Name
())
config
[
"
path
"
]
=
tf
.
Name
()
config
[
"
script
"
]
=
tf
.
Name
()
p
=
new
(
Provisioner
)
err
=
p
.
Prepare
(
config
)
if
err
!=
nil
{
...
...
@@ -61,12 +61,12 @@ func TestProvisionerPrepare_Path(t *testing.T) {
}
}
func
TestProvisionerPrepare_
Path
AndInline
(
t
*
testing
.
T
)
{
func
TestProvisionerPrepare_
Script
AndInline
(
t
*
testing
.
T
)
{
var
p
Provisioner
config
:=
testConfig
()
delete
(
config
,
"inline"
)
delete
(
config
,
"
path
"
)
delete
(
config
,
"
script
"
)
err
:=
p
.
Prepare
(
config
)
if
err
==
nil
{
t
.
Fatal
(
"should have error"
)
...
...
@@ -80,14 +80,14 @@ func TestProvisionerPrepare_PathAndInline(t *testing.T) {
defer
os
.
Remove
(
tf
.
Name
())
config
[
"inline"
]
=
[]
interface
{}{
"foo"
}
config
[
"
path
"
]
=
tf
.
Name
()
config
[
"
script
"
]
=
tf
.
Name
()
err
=
p
.
Prepare
(
config
)
if
err
==
nil
{
t
.
Fatal
(
"should have error"
)
}
}
func
TestProvisionerPrepare_
Path
AndScripts
(
t
*
testing
.
T
)
{
func
TestProvisionerPrepare_
Script
AndScripts
(
t
*
testing
.
T
)
{
var
p
Provisioner
config
:=
testConfig
()
...
...
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