Class: Api::V2::AnsibleInventoriesController
- Inherits:
-
BaseController
- Object
- BaseController
- Api::V2::AnsibleInventoriesController
- Includes:
- Api::Version2
- Defined in:
- app/controllers/api/v2/ansible_inventories_controller.rb
Instance Method Summary collapse
Instance Method Details
#action_permission ⇒ Object
79 80 81 82 83 84 85 86 87 88 |
# File 'app/controllers/api/v2/ansible_inventories_controller.rb', line 79 def case params[:action] when 'hosts', 'hostgroups' :view when 'schedule' :generate else super end end |
#hostgroups ⇒ Object
35 36 37 |
# File 'app/controllers/api/v2/ansible_inventories_controller.rb', line 35 def hostgroups show_inventory :hostgroup_ids, :hostgroup_id end |
#hosts ⇒ Object
21 22 23 |
# File 'app/controllers/api/v2/ansible_inventories_controller.rb', line 21 def hosts show_inventory :host_ids, :id end |
#schedule ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'app/controllers/api/v2/ansible_inventories_controller.rb', line 61 def schedule @composer = ReportComposer.from_api_params(schedule_params) if @composer.valid? job = @composer.schedule_rendering response = { :job_id => job.provider_job_id } response[:data_url] = report_data_api_report_template_path( @report_template, :job_id => job.provider_job_id ) render :json => response else @ansible_inventory = @composer process_resource_error(:resource => @ansible_inventory) end rescue StandardError => e render_error :custom_error, :status => :unprocessable_entity, :locals => { :message => _("Scheduling Report template failed for: #{e.}") } end |