Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1793)

Issue 14197043: environs/sshstorage: stream stdin

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 6 months ago by axw
Modified:
10 years, 6 months ago
Reviewers:
axw1, jameinel, mp+188508, rog
Visibility:
Public.

Description

environs/sshstorage: stream stdin Change sshstorage's Put to stream to the ssh command's stdin, rather than reading into memory and then writing. Also, drive-by: use `mktemp --tmpdir` rather than exporting $TMPDIR. https://code.launchpad.net/~axwalk/juju-core/sshstorage-stream-input/+merge/188508 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : environs/sshstorage: stream stdin #

Total comments: 6

Patch Set 3 : environs/sshstorage: stream stdin #

Patch Set 4 : environs/sshstorage: stream stdin #

Total comments: 6

Patch Set 5 : environs/sshstorage: stream stdin #

Unified diffs Side-by-side diffs Delta from patch set Stats (+258 lines, -22 lines) Patch
A [revision details] View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
A environs/sshstorage/export_test.go View 1 2 1 chunk +8 lines, -0 lines 0 comments Download
A environs/sshstorage/linewrapwriter.go View 1 2 3 4 1 chunk +57 lines, -0 lines 0 comments Download
A environs/sshstorage/linewrapwriter_test.go View 1 2 3 1 chunk +151 lines, -0 lines 0 comments Download
M environs/sshstorage/storage.go View 1 2 3 4 4 chunks +26 lines, -17 lines 0 comments Download
M environs/sshstorage/storage_test.go View 1 2 3 2 chunks +0 lines, -5 lines 0 comments Download
A environs/sshstorage/suite_test.go View 1 2 3 1 chunk +14 lines, -0 lines 0 comments Download

Messages

Total messages: 10
axw
Please take a look.
10 years, 6 months ago (2013-10-01 04:43:45 UTC) #1
axw
Please take a look.
10 years, 6 months ago (2013-10-01 09:59:13 UTC) #2
axw
Please take a look.
10 years, 6 months ago (2013-10-01 10:26:40 UTC) #3
rog
Thanks for doing this. Looks good, with a few suggestions below. https://codereview.appspot.com/14197043/diff/1003/environs/sshstorage/storage.go File environs/sshstorage/storage.go (right): ...
10 years, 6 months ago (2013-10-01 10:27:39 UTC) #4
jameinel
https://codereview.appspot.com/14197043/diff/1003/environs/sshstorage/storage.go File environs/sshstorage/storage.go (right): https://codereview.appspot.com/14197043/diff/1003/environs/sshstorage/storage.go#newcode153 environs/sshstorage/storage.go:153: command = fmt.Sprintf("(%s) << EOF", command) On 2013/10/01 10:27:39, ...
10 years, 6 months ago (2013-10-01 11:09:25 UTC) #5
rog
On 1 October 2013 12:09, <john.meinel@canonical.com> wrote: > > https://codereview.appspot.com/14197043/diff/1003/environs/sshstorage/storage.go > File environs/sshstorage/storage.go (right): > ...
10 years, 6 months ago (2013-10-01 11:46:18 UTC) #6
axw
Please take a look.
10 years, 6 months ago (2013-10-01 14:56:50 UTC) #7
rog
LGTM modulo the below suggestions. Thanks! https://codereview.appspot.com/14197043/diff/14001/environs/sshstorage/linewrapwriter.go File environs/sshstorage/linewrapwriter.go (right): https://codereview.appspot.com/14197043/diff/14001/environs/sshstorage/linewrapwriter.go#newcode22 environs/sshstorage/linewrapwriter.go:22: // after every ...
10 years, 6 months ago (2013-10-01 15:28:47 UTC) #8
axw
Please take a look.
10 years, 6 months ago (2013-10-02 04:07:53 UTC) #9
axw1
10 years, 6 months ago (2013-10-02 05:20:27 UTC) #10
https://codereview.appspot.com/14197043/diff/14001/environs/sshstorage/linewr...
File environs/sshstorage/linewrapwriter.go (right):

https://codereview.appspot.com/14197043/diff/14001/environs/sshstorage/linewr...
environs/sshstorage/linewrapwriter.go:22: // after every "lineLength" bytes.
On 2013/10/01 15:28:47, rog wrote:
> // Moreover it gives no consideration to multibyte
> // utf-8 characters, which it can split arbitrarily.

Done.

https://codereview.appspot.com/14197043/diff/14001/environs/sshstorage/storag...
File environs/sshstorage/storage.go (right):

https://codereview.appspot.com/14197043/diff/14001/environs/sshstorage/storag...
environs/sshstorage/storage.go:149: stdin = bufio.NewWriter(s.stdin)
On 2013/10/01 15:28:47, rog wrote:
> I'm not sure this half-way house is great.
> I'd either make s.stdin a bufio.Writer, or
> call NewWriter inside the later "if input != nil" block,
> avoiding the ugly dynamic type conversion either way,
> and allowing the use of the more natural WriteString
> methods.

It's not in the later block because it's used before then. If it were in there,
then we'd have two writes to s.stdin.

I agree about the ugliness, though. I'll wrap s.stdin, but only in this function
so as not to lose the WriteCloser interface.

https://codereview.appspot.com/14197043/diff/14001/environs/sshstorage/storag...
environs/sshstorage/storage.go:154: // here-document must start on the
outer-most command.
On 2013/10/01 15:28:47, rog wrote:
> That's not actually the case, I think. Did you try it?

I did, but I'm not sure what I was doing before to cause it to fail. I *think* I
may have had a bug where something was being wrapped twice, and ended up as
((command << EOF)).

Anyway, I've put it after 'base64 -d' and it does indeed work fine. Thanks.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b