Class: SSHKit::Runner::Abstract
- Inherits:
-
Object
- Object
- SSHKit::Runner::Abstract
- Defined in:
- lib/core_ext/sshkit/runner/abstract.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#backends ⇒ Object
Returns the value of attribute backends.
Class Method Summary collapse
Instance Method Summary collapse
- #active_backend ⇒ Object
- #active_backend=(new_backend) ⇒ Object
- #send_cmd(cmd, *args, &block) ⇒ Object
Instance Attribute Details
#backends ⇒ Object
Returns the value of attribute backends.
4 5 6 |
# File 'lib/core_ext/sshkit/runner/abstract.rb', line 4 def backends @backends end |
Class Method Details
.active_backend ⇒ Object
14 15 16 |
# File 'lib/core_ext/sshkit/runner/abstract.rb', line 14 def self.active_backend Thread.current[:active_backend] end |
.active_backend=(new_backend) ⇒ Object
18 19 20 |
# File 'lib/core_ext/sshkit/runner/abstract.rb', line 18 def self.active_backend=(new_backend) Thread.current[:active_backend]=new_backend end |
Instance Method Details
#active_backend ⇒ Object
6 7 8 |
# File 'lib/core_ext/sshkit/runner/abstract.rb', line 6 def active_backend self.class.active_backend end |
#active_backend=(new_backend) ⇒ Object
10 11 12 |
# File 'lib/core_ext/sshkit/runner/abstract.rb', line 10 def active_backend=(new_backend) self.class.active_backend=new_backend end |
#send_cmd(cmd, *args, &block) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/core_ext/sshkit/runner/abstract.rb', line 22 def send_cmd(cmd, *args, &block) begin if block args = Array(block.call(active_backend.host)) end active_backend.send(cmd, *args) rescue Exception => e e2 = ExecuteError.new e raise e2, "Exception while executing on host #{active_backend.host}: #{e.message}" end end |