You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using sshkit for parallel execution of commands on several servers. If there is an exit on one of the servers, then the exception is raised and execution on all the servers stops.
As per the my requirements only that host should be skipped continuing other hosts. Can this be achieved with the current code?
Here is an example code
require 'sshkit'
require 'sshkit/dsl'
include SSHKit::DSL
hosts = ['[email protected]', '[email protected]', '[email protected]']
on hosts, in: :parallel do |host|
execute './script.sh'
execute './script_with_exit.sh'
end
The text was updated successfully, but these errors were encountered:
Hi, thanks for the question. You should also check on Stack Overflow to see if you get more answers there.
The requirement you describe is not possible with the current execution model of SSHKit, at least out of the box. You might be able to plug in your own custom runner to do this.
In other words, instead of this:
in: :parallel
You could write this:
in: ParallelIgnoringErrors
And define the runner as follows:
classParallelIgnoringErrors < SSHKit::Runner::Abstractdefexecute# your custom execution logic goes hereendend
If you get it to work, let us know, and we can discuss whether this belongs in SSHKit and/or something that should be called out in the docs.
Using test() rather than execute returns the result of the command rather
than erring if it's non zero. test() is just a wrapper around execute()
which sets certain flags on the command object (namely not to raise on
exceptions) - depending on the nature of your failure this may or may not
do what you want. See our examples file in the root of the project.
(Sent from my Nexus 6, please forgive typos!)
On Dec 27, 2016 18:53, "Matt Brictson" ***@***.***> wrote:
Hi, thanks for the question. You should also check on Stack Overflow to
see if you get more answers there.
The requirement you describe is not possible with the current execution
model of SSHKit, at least out of the box. You might be able to plug in your
own custom runner to do this.
In other words, instead of this:
in: :parallel
You could write this:
in: ParallelIgnoringErrors
And define the runner as follows:
class ParallelIgnoringErrors < SSHKit::Runner::Abstract
def execute
# your custom execution logic goes here
endend
If you get it to work, let us know, and we can discuss whether this
belongs in SSHKit and/or something that should be called out in the docs.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#384 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABKCBV7VhSbouyrlmTycQpMw94tIekqks5rMVCPgaJpZM4LWZyB>
.
I am using sshkit for parallel execution of commands on several servers. If there is an exit on one of the servers, then the exception is raised and execution on all the servers stops.
As per the my requirements only that host should be skipped continuing other hosts. Can this be achieved with the current code?
Here is an example code
The text was updated successfully, but these errors were encountered: