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
8cdb92e3
Commit
8cdb92e3
authored
Sep 25, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
communicator/ssh: dir upload works when dir contains symlinks [Gh-449]
parent
3e82c6cf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
CHANGELOG.md
CHANGELOG.md
+2
-0
communicator/ssh/communicator.go
communicator/ssh/communicator.go
+21
-2
No files found.
CHANGELOG.md
View file @
8cdb92e3
...
...
@@ -4,6 +4,8 @@ BUG FIXES:
*
core: default user variable values don't need to be strings. [GH-456]
*
builder/amazon-chroot: Fix errors with waitin for state change. [GH-459]
*
communicator/ssh: SCP uploads now work properly when directories
contain symlinks. [GH-449]
## 0.3.8 (September 22, 2013)
...
...
communicator/ssh/communicator.go
View file @
8cdb92e3
...
...
@@ -408,8 +408,27 @@ func scpUploadDir(root string, fs []os.FileInfo, w io.Writer, r *bufio.Reader) e
for
_
,
fi
:=
range
fs
{
realPath
:=
filepath
.
Join
(
root
,
fi
.
Name
())
if
!
fi
.
IsDir
()
{
// It is a regular file, just upload it
// Track if this is actually a symlink to a directory. If it is
// a symlink to a file we don't do any special behavior because uploading
// a file just works. If it is a directory, we need to know so we
// treat it as such.
isSymlinkToDir
:=
false
if
fi
.
Mode
()
&
os
.
ModeSymlink
==
os
.
ModeSymlink
{
symPath
,
err
:=
filepath
.
EvalSymlinks
(
realPath
)
if
err
!=
nil
{
return
err
}
symFi
,
err
:=
os
.
Lstat
(
symPath
)
if
err
!=
nil
{
return
err
}
isSymlinkToDir
=
symFi
.
IsDir
()
}
if
!
fi
.
IsDir
()
&&
!
isSymlinkToDir
{
// It is a regular file (or symlink to a file), just upload it
f
,
err
:=
os
.
Open
(
realPath
)
if
err
!=
nil
{
return
err
...
...
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