Class: PuppetX::Relay::Agent::Backend::Orchestrator
- Defined in:
- lib/puppet_x/relay/agent/backend/orchestrator.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #exec(run, _state_dir, schedule) ⇒ Object
-
#initialize(relay_api, orchestrator_api) ⇒ Orchestrator
constructor
A new instance of Orchestrator.
Constructor Details
#initialize(relay_api, orchestrator_api) ⇒ Orchestrator
Returns a new instance of Orchestrator.
15 16 17 18 |
# File 'lib/puppet_x/relay/agent/backend/orchestrator.rb', line 15 def initialize(relay_api, orchestrator_api) super(relay_api) @orchestrator_api = orchestrator_api end |
Instance Method Details
#exec(run, _state_dir, schedule) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/puppet_x/relay/agent/backend/orchestrator.rb', line 20 def exec(run, _state_dir, schedule) case run.state.status when :pending case run when Model::Run deploy(run, schedule) when Model::TaskRun task(run, schedule) when Model::PlanRun plan_run(run, schedule) else raise NotImplementedError end else case run when Model::Run, Model::TaskRun check_job_complete(run, schedule) when Model::PlanRun check_plan_job_complete(run, schedule) else raise NotImplementedError end end rescue Net::HTTPError, Net::HTTPRetriableError, Net::HTTPServerException, Net::HTTPFatalError => e Puppet.warning(_('Failed to send request to orchestrator API: %{message}, response: %{body}') % { message: e., body: e.response.body, }) raise end |