Sha256: ee94ae767eb429f406a767abc41a12fb61d20fdca0e0b9ef0e1822d7fbc66c46

Contents?: true

Size: 806 Bytes

Versions: 62

Compression:

Stored size: 806 Bytes

Contents

class SyncRolesAndVariables < ::ApplicationJob
  queue_as :default

  def perform(changed, proxy)
    roles_importer = ForemanAnsible::UiRolesImporter.new(proxy)
    variables_importer = ForemanAnsible::VariablesImporter.new(proxy)
    roles_importer.finish_import(changed)
    variables_importer.import_variables_roles(changed) if changed['new'] || changed['old']
    task = ForemanTasks::Task.where(:external_id => @provider_job_id)[0]
    ForemanAnsible::ImportRolesAndVariablesSuccessNotification.deliver!(task)
  rescue StandardError => e
    task = ForemanTasks::Task.where(:external_id => @provider_job_id)[0]
    notification = ForemanAnsible::ImportRolesAndVariablesErrorNotification.new(e, task)
    notification.deliver!
  end

  def humanized_name
    _('Import roles And Variables')
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
foreman_ansible-6.4.0 app/jobs/sync_roles_and_variables.rb
foreman_ansible-6.3.0 app/jobs/sync_roles_and_variables.rb