Class: Indocker::Launchers::DTO::RemoteOperationDTO
- Inherits:
-
Object
- Object
- Indocker::Launchers::DTO::RemoteOperationDTO
- Defined in:
- lib/indocker/launchers/dto/remote_operation_dto.rb
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#operation ⇒ Object
readonly
Returns the value of attribute operation.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
-
#thread ⇒ Object
readonly
Returns the value of attribute thread.
Class Method Summary collapse
-
.spawn(server, operation, message = nil, &block) ⇒ Object
Runs a remote operation in a thread that keeps its failure to itself, so that wait_remote_operations can re-raise it on join and report which server failed.
Instance Method Summary collapse
-
#initialize(thread, server, operation, message = nil) ⇒ RemoteOperationDTO
constructor
A new instance of RemoteOperationDTO.
Constructor Details
#initialize(thread, server, operation, message = nil) ⇒ RemoteOperationDTO
Returns a new instance of RemoteOperationDTO.
21 22 23 24 25 26 |
# File 'lib/indocker/launchers/dto/remote_operation_dto.rb', line 21 def initialize(thread, server, operation, = nil) @thread = thread @server = server @operation = operation @message = end |
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
2 3 4 |
# File 'lib/indocker/launchers/dto/remote_operation_dto.rb', line 2 def @message end |
#operation ⇒ Object (readonly)
Returns the value of attribute operation.
2 3 4 |
# File 'lib/indocker/launchers/dto/remote_operation_dto.rb', line 2 def operation @operation end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
2 3 4 |
# File 'lib/indocker/launchers/dto/remote_operation_dto.rb', line 2 def server @server end |
#thread ⇒ Object (readonly)
Returns the value of attribute thread.
2 3 4 |
# File 'lib/indocker/launchers/dto/remote_operation_dto.rb', line 2 def thread @thread end |
Class Method Details
.spawn(server, operation, message = nil, &block) ⇒ Object
Runs a remote operation in a thread that keeps its failure to itself, so that wait_remote_operations can re-raise it on join and report which server failed. Left to the global abort_on_exception/report_on_exception defaults, a failed ssh dumps a raw backtrace and tears the deploy down from inside the thread, naming no server at all. The flags are set inside the thread so that they are in place before the operation gets a chance to fail.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/indocker/launchers/dto/remote_operation_dto.rb', line 10 def self.spawn(server, operation, = nil, &block) thread = Thread.new do Thread.current.abort_on_exception = false Thread.current.report_on_exception = false block.call end new(thread, server, operation, ) end |