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
d857c9cc
Commit
d857c9cc
authored
Aug 23, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/amazon/chroot: implement UploadDir for chroot communicator
parent
1010c8ae
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
0 deletions
+36
-0
builder/amazon/chroot/communicator.go
builder/amazon/chroot/communicator.go
+32
-0
communicator/ssh/communicator.go
communicator/ssh/communicator.go
+4
-0
No files found.
builder/amazon/chroot/communicator.go
View file @
d857c9cc
...
...
@@ -70,6 +70,38 @@ func (c *Communicator) Upload(dst string, r io.Reader) error {
return
nil
}
func
(
c
*
Communicator
)
UploadDir
(
dst
string
,
src
string
,
exclude
[]
string
)
error
{
walkFn
:=
func
(
fullPath
string
,
info
os
.
FileInfo
,
err
error
)
error
{
if
err
!=
nil
{
return
err
}
path
,
err
:=
filepath
.
Rel
(
src
,
fullPath
)
if
err
!=
nil
{
return
err
}
for
_
,
e
:=
range
exclude
{
if
e
==
path
{
log
.
Printf
(
"Skipping excluded file: %s"
,
path
)
return
nil
}
}
dstPath
:=
filepath
.
Join
(
dst
,
path
)
f
,
err
:=
os
.
Open
(
fullPath
)
if
err
!=
nil
{
return
err
}
defer
f
.
Close
()
return
c
.
Upload
(
dstPath
,
f
)
}
log
.
Printf
(
"Uploading directory '%s' to '%s'"
,
src
,
dst
)
return
filepath
.
Walk
(
src
,
walkFn
)
}
func
(
c
*
Communicator
)
Download
(
src
string
,
w
io
.
Writer
)
error
{
src
=
filepath
.
Join
(
c
.
Chroot
,
src
)
log
.
Printf
(
"Downloading from chroot dir: %s"
,
src
)
...
...
communicator/ssh/communicator.go
View file @
d857c9cc
...
...
@@ -204,6 +204,10 @@ func (c *comm) Upload(path string, input io.Reader) error {
return
nil
}
func
(
c
*
comm
)
UploadDir
(
dst
string
,
src
string
,
excl
[]
string
)
error
{
return
nil
}
func
(
c
*
comm
)
Download
(
string
,
io
.
Writer
)
error
{
panic
(
"not implemented yet"
)
}
...
...
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