Class: Bosh::Director::Errand::Runner::ErrandResult
- Defined in:
- lib/bosh/director/errand/runner.rb
Constant Summary collapse
- AGENT_TASK_RESULT_SCHEMA =
::Membrane::SchemaParser.parse do { 'exit_code' => Integer, 'stdout' => String, 'stderr' => String, } end
Instance Attribute Summary collapse
-
#exit_code ⇒ Object
readonly
Returns the value of attribute exit_code.
Class Method Summary collapse
-
.from_agent_task_result(agent_task_result) ⇒ Object
Explicitly write out schema of the director task result to avoid accidently leaking agent task result extra fields.
Instance Method Summary collapse
-
#initialize(exit_code, stdout, stderr) ⇒ ErrandResult
constructor
A new instance of ErrandResult.
- #to_hash ⇒ Object
Constructor Details
#initialize(exit_code, stdout, stderr) ⇒ ErrandResult
Returns a new instance of ErrandResult.
25 26 27 28 29 |
# File 'lib/bosh/director/errand/runner.rb', line 25 def initialize(exit_code, stdout, stderr) @exit_code = exit_code @stdout = stdout @stderr = stderr end |
Instance Attribute Details
#exit_code ⇒ Object (readonly)
Returns the value of attribute exit_code.
6 7 8 |
# File 'lib/bosh/director/errand/runner.rb', line 6 def exit_code @exit_code end |
Class Method Details
.from_agent_task_result(agent_task_result) ⇒ Object
Explicitly write out schema of the director task result to avoid accidently leaking agent task result extra fields.
18 19 20 21 22 23 |
# File 'lib/bosh/director/errand/runner.rb', line 18 def self.from_agent_task_result(agent_task_result) AGENT_TASK_RESULT_SCHEMA.validate(agent_task_result) new(*agent_task_result.values_at('exit_code', 'stdout', 'stderr')) rescue Membrane::SchemaValidationError => e raise AgentInvalidTaskResult, e. end |
Instance Method Details
#to_hash ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/bosh/director/errand/runner.rb', line 31 def to_hash { 'exit_code' => @exit_code, 'stdout' => @stdout, 'stderr' => @stderr, } end |