Class: HammerCLIForemanRemoteExecution::JobInvocation

Inherits:
HammerCLIForeman::Command
  • Object
show all
Defined in:
lib/hammer_cli_foreman_remote_execution/job_invocation.rb

Defined Under Namespace

Modules: BaseOutput, WithoutNameOption Classes: CancelCommand, CreateCommand, InfoCommand, ListCommand, OutputCommand, RerunCommand

Class Method Summary collapse

Class Method Details

.extend_data(invocation) ⇒ Object



231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
# File 'lib/hammer_cli_foreman_remote_execution/job_invocation.rb', line 231

def self.extend_data(invocation)
  if (targeting = invocation['targeting']) && invocation['targeting']['hosts']
    invocation['randomized_ordering'] = targeting['randomized_ordering'] || false

    hosts = targeting['hosts'].map do |host|
      { 'Name' => host['name'], 'Job status' => host['job_status'], 'Inputs' => host[:inputs] }.compact
    end
    invocation['hosts'] = hosts
  end

  if invocation['recurrence']
    invocation['cron_line'] = invocation['recurrence']['cron_line']
    invocation['recurring_logic_id'] = invocation['recurrence']['id']
  end

  invocation
end