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
f726ea28
Commit
f726ea28
authored
May 27, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
provisioner/shell: Start working on shell provisioner
parent
81d8b207
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
0 deletions
+25
-0
provisioner/shell/provisioner.go
provisioner/shell/provisioner.go
+15
-0
provisioner/shell/provisioner_test.go
provisioner/shell/provisioner_test.go
+10
-0
No files found.
provisioner/shell/provisioner.go
View file @
f726ea28
...
@@ -3,11 +3,20 @@
...
@@ -3,11 +3,20 @@
package
shell
package
shell
import
(
import
(
"github.com/mitchellh/mapstructure"
"github.com/mitchellh/packer/packer"
"github.com/mitchellh/packer/packer"
)
)
const
DefaultRemotePath
=
"/tmp/script.sh"
// TODO(mitchellh): config
// TODO(mitchellh): config
type
config
struct
{
type
config
struct
{
// The local path of the shell script to upload and execute.
Path
string
// The remote path where the local shell script will be uploaded to.
// This should be set to a writable file that is in a pre-existing directory.
RemotePath
string
}
}
type
Provisioner
struct
{
type
Provisioner
struct
{
...
@@ -15,6 +24,12 @@ type Provisioner struct {
...
@@ -15,6 +24,12 @@ type Provisioner struct {
}
}
func
(
p
*
Provisioner
)
Prepare
(
raw
interface
{},
ui
packer
.
Ui
)
{
func
(
p
*
Provisioner
)
Prepare
(
raw
interface
{},
ui
packer
.
Ui
)
{
// TODO: errors
_
=
mapstructure
.
Decode
(
raw
,
&
p
.
config
)
if
p
.
config
.
RemotePath
==
""
{
p
.
config
.
RemotePath
=
DefaultRemotePath
}
}
}
func
(
p
*
Provisioner
)
Provision
(
ui
packer
.
Ui
,
comm
packer
.
Communicator
)
{
func
(
p
*
Provisioner
)
Provision
(
ui
packer
.
Ui
,
comm
packer
.
Communicator
)
{
...
...
provisioner/shell/provisioner_test.go
View file @
f726ea28
...
@@ -13,3 +13,13 @@ func TestProvisioner_Impl(t *testing.T) {
...
@@ -13,3 +13,13 @@ func TestProvisioner_Impl(t *testing.T) {
}
}
}
}
func
TestProvisionerPrepare_Defaults
(
t
*
testing
.
T
)
{
raw
:=
map
[
string
]
interface
{}
{}
p
:=
&
Provisioner
{}
p
.
Prepare
(
raw
,
nil
)
if
p
.
config
.
RemotePath
!=
DefaultRemotePath
{
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