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
d2f9ba0d
Commit
d2f9ba0d
authored
Sep 27, 2013
by
Matthew Hooker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixing up types.
parent
ac496a63
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
5 deletions
+17
-5
builder/amazon/chroot/builder_test.go
builder/amazon/chroot/builder_test.go
+11
-0
builder/amazon/chroot/copy_files_test.go
builder/amazon/chroot/copy_files_test.go
+3
-1
builder/amazon/chroot/step_chroot_provision.go
builder/amazon/chroot/step_chroot_provision.go
+2
-2
builder/amazon/chroot/step_copy_files.go
builder/amazon/chroot/step_copy_files.go
+0
-1
builder/amazon/chroot/step_mount_device.go
builder/amazon/chroot/step_mount_device.go
+1
-1
No files found.
builder/amazon/chroot/builder_test.go
View file @
d2f9ba0d
...
...
@@ -82,3 +82,14 @@ func TestBuilderPrepare_SourceAmi(t *testing.T) {
t
.
Errorf
(
"err: %s"
,
err
)
}
}
func
TestBuilderPrepare_CommandWrapper
(
t
*
testing
.
T
)
{
b
:=
&
Builder
{}
config
:=
testConfig
()
config
[
"command_wrapper"
]
=
"echo hi; {{.Command}}"
err
:=
b
.
Prepare
(
config
)
if
err
!=
nil
{
t
.
Errorf
(
"err: %s"
,
err
)
}
}
builder/amazon/chroot/copy_files_test.go
View file @
d2f9ba0d
...
...
@@ -18,8 +18,10 @@ func TestCopyFile(t *testing.T) {
if
_
,
err
=
first
.
WriteString
(
payload
);
err
!=
nil
{
t
.
Fatalf
(
"Couldn't write payload to first file."
)
}
first
.
Sync
()
if
err
:=
copySingle
(
newName
,
first
.
Name
(),
"cp"
);
err
!=
nil
{
cmd
:=
ShellCommand
(
fmt
.
Sprintf
(
"cp %s %s"
,
first
.
Name
(),
newName
))
if
err
:=
cmd
.
Run
();
err
!=
nil
{
t
.
Fatalf
(
"Couldn't copy file"
)
}
defer
os
.
Remove
(
newName
)
...
...
builder/amazon/chroot/step_chroot_provision.go
View file @
d2f9ba0d
...
...
@@ -13,7 +13,7 @@ type StepChrootProvision struct {
}
type
WrappedCommandTemplate
struct
{
c
ommand
string
C
ommand
string
}
func
(
s
*
StepChrootProvision
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
...
...
@@ -26,7 +26,7 @@ func (s *StepChrootProvision) Run(state multistep.StateBag) multistep.StepAction
}
wrappedCommand
:=
func
(
command
string
)
*
exec
.
Cmd
{
wrapped
,
err
:=
config
.
tpl
.
Process
(
config
.
CommandWrapper
,
&
WrappedCommandTemplate
{
c
ommand
:
command
,
C
ommand
:
command
,
})
if
err
!=
nil
{
ui
.
Error
(
err
.
Error
())
...
...
builder/amazon/chroot/step_copy_files.go
View file @
d2f9ba0d
...
...
@@ -60,7 +60,6 @@ func (s *StepCopyFiles) CleanupFunc(state multistep.StateBag) error {
for
_
,
file
:=
range
s
.
files
{
log
.
Printf
(
"Removing: %s"
,
file
)
localCmd
:=
wrappedCommand
(
fmt
.
Sprintf
(
"rm -f %s"
,
file
))
log
.
Println
(
localCmd
.
Args
)
if
err
:=
localCmd
.
Run
();
err
!=
nil
{
return
err
}
...
...
builder/amazon/chroot/step_mount_device.go
View file @
d2f9ba0d
...
...
@@ -59,7 +59,7 @@ func (s *StepMountDevice) Run(state multistep.StateBag) multistep.StepAction {
ui
.
Say
(
"Mounting the root device..."
)
stderr
:=
new
(
bytes
.
Buffer
)
mountCommand
:=
fmt
.
Sprintf
(
"mount %s %s"
,
device
,
mountPath
)
wrappedCommand
:=
state
.
Get
(
"wrappedCommand"
)
.
(
Command
)
wrappedCommand
:=
state
.
Get
(
"wrappedCommand"
)
.
(
*
Command
)
cmd
:=
wrappedCommand
(
mountCommand
)
cmd
.
Stderr
=
stderr
if
err
:=
cmd
.
Run
();
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