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
cc16e19a
Commit
cc16e19a
authored
Sep 10, 2014
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
communicator/ssh: upload proper source [GH-1484]
parent
42e9e734
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
12 deletions
+13
-12
CHANGELOG.md
CHANGELOG.md
+1
-0
communicator/ssh/communicator.go
communicator/ssh/communicator.go
+12
-12
No files found.
CHANGELOG.md
View file @
cc16e19a
...
...
@@ -7,6 +7,7 @@ FEATURES:
BUG FIXES:
*
core: SSH will connect slightly faster if it is ready immediately.
*
provisioner/file: directory uploads no longer hang. [GH-1484]
*
scripts: Windows executable renamed to packer.exe. [GH-1483]
## 0.7.0 (September 8, 2014)
...
...
communicator/ssh/communicator.go
View file @
cc16e19a
...
...
@@ -333,6 +333,13 @@ func checkSCPStatus(r *bufio.Reader) error {
}
func
scpUploadFile
(
dst
string
,
src
io
.
Reader
,
w
io
.
Writer
,
r
*
bufio
.
Reader
,
fi
*
os
.
FileInfo
)
error
{
var
mode
os
.
FileMode
var
size
int64
if
fi
!=
nil
{
mode
=
(
*
fi
)
.
Mode
()
.
Perm
()
size
=
(
*
fi
)
.
Size
()
}
else
{
// Create a temporary file where we can copy the contents of the src
// so that we can determine the length, since SCP is length-prefixed.
tf
,
err
:=
ioutil
.
TempFile
(
""
,
"packer-upload"
)
...
...
@@ -342,13 +349,6 @@ func scpUploadFile(dst string, src io.Reader, w io.Writer, r *bufio.Reader, fi *
defer
os
.
Remove
(
tf
.
Name
())
defer
tf
.
Close
()
var
mode
os
.
FileMode
var
size
int64
if
fi
!=
nil
{
mode
=
(
*
fi
)
.
Mode
()
.
Perm
()
size
=
(
*
fi
)
.
Size
()
}
else
{
mode
=
0644
log
.
Println
(
"Copying input data into temporary file so we can read the length"
)
...
...
@@ -373,19 +373,19 @@ func scpUploadFile(dst string, src io.Reader, w io.Writer, r *bufio.Reader, fi *
}
size
=
tfi
.
Size
()
src
=
tf
}
// Start the protocol
log
.
Println
(
"Beginning file upload..."
)
perms
:=
fmt
.
Sprintf
(
"C%04o"
,
mode
)
log
.
Printf
(
"[DEBUG] Uploading %s: perms=%s size=%d"
,
dst
,
perms
,
size
)
fmt
.
Fprintln
(
w
,
perms
,
size
,
dst
)
if
err
:=
checkSCPStatus
(
r
);
err
!=
nil
{
return
err
}
if
_
,
err
:=
io
.
Copy
(
w
,
tf
);
err
!=
nil
{
if
_
,
err
:=
io
.
Copy
N
(
w
,
src
,
size
);
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