DescriptionFix for bug 1246938: ssh exit status lost
Bug 1246938 sugegsts to use the exit code from an ssh subprocess as
the exit status of juju itself.
"juju run" already has some provisions for this behavior; I added a
similar treatment of the result of c.Wait() to Cmd.Run() in utils/ssh/ssh.go
This function now returns an rcPassthroughError when the subprocess properly
exits but returns a non-zero status code.
The function SuperCommand.Run() just logged any error and replaced it
with ErrSilent, thus spoiling the whole purpose of rcPassthroughError.
I changed this function so rcPassthroughError is no longer replaced.
This changes the behaviour of "juju run" as well:
juju run --machine 1 "ls /asd" ; echo $?
ls: cannot access /asd: No such file or directory
ERROR rc: 2
2
juju ssh 1 ls /asd ; echo $?
ls: cannot access /asd: No such file or directory
Connection to 10.0.3.195 closed.
ERROR rc: 2
2
https://code.launchpad.net/~adeuring/juju-core/1246938/+merge/205160
(do not edit description out of merge proposal)
Patch Set 1 #
Total comments: 4
Patch Set 2 : Fix for bug 1246938: ssh exit status lost #
Total comments: 1
MessagesTotal messages: 6
|