Class: ImportPlaybooksJob::Async::SyncPlaybooks

Inherits:
Actions::EntryAction
  • Object
show all
Defined in:
app/jobs/import_playbooks_job/async/sync_playbooks.rb

Instance Method Summary collapse

Instance Method Details

#plan(proxy_id, playbooks_names) ⇒ Object



4
5
6
# File 'app/jobs/import_playbooks_job/async/sync_playbooks.rb', line 4

def plan(proxy_id, playbooks_names)
  plan_self(proxy_id: proxy_id, playbooks_names: playbooks_names)
end

#playbooks_namesObject



20
21
22
# File 'app/jobs/import_playbooks_job/async/sync_playbooks.rb', line 20

def playbooks_names
  input[:playbooks_names]
end

#proxyObject



16
17
18
# File 'app/jobs/import_playbooks_job/async/sync_playbooks.rb', line 16

def proxy
  SmartProxy.find(input[:proxy_id])
end

#runObject



8
9
10
11
12
13
14
# File 'app/jobs/import_playbooks_job/async/sync_playbooks.rb', line 8

def run
  playbooks_importer = ForemanAnsible::PlaybooksImporter.new(proxy)
  output[:result] = playbooks_importer.import_playbooks(playbooks_names)
  ForemanAnsible::ImportPlaybooksSuccessNotification.deliver!(task)
rescue StandardError => e
  ForemanAnsible::ImportPlaybooksErrorNotification.new(e, task).deliver!
end