Module: ForemanAnsible::Concerns::ApiCommon
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/controllers/foreman_ansible/concerns/api_common.rb
Overview
Shared task methods between api controllers
Instance Method Summary collapse
- #find_ansible_role ⇒ Object
- #find_ansible_roles ⇒ Object
- #find_host_ansible_role ⇒ Object
- #find_hostgroup_ansible_role ⇒ Object
Instance Method Details
#find_ansible_role ⇒ Object
16 17 18 19 20 |
# File 'app/controllers/foreman_ansible/concerns/api_common.rb', line 16 def find_ansible_role @ansible_role = AnsibleRole.(:view_ansible_roles).find(params[:ansible_role_id]) rescue ActiveRecord::RecordNotFound => e not_found(e.) end |
#find_ansible_roles ⇒ Object
9 10 11 12 13 14 |
# File 'app/controllers/foreman_ansible/concerns/api_common.rb', line 9 def find_ansible_roles ids = params.fetch(:ansible_role_ids, []) || [] @ansible_roles = AnsibleRole.(:view_ansible_roles).find(ids) rescue ActiveRecord::RecordNotFound => e not_found(e.) end |
#find_host_ansible_role ⇒ Object
22 23 24 25 26 27 |
# File 'app/controllers/foreman_ansible/concerns/api_common.rb', line 22 def find_host_ansible_role find_ansible_role @host = Host.(:view_hosts).find(params[:id]) rescue ActiveRecord::RecordNotFound => e not_found(e.) end |
#find_hostgroup_ansible_role ⇒ Object
29 30 31 32 33 34 |
# File 'app/controllers/foreman_ansible/concerns/api_common.rb', line 29 def find_hostgroup_ansible_role find_ansible_role @hostgroup = Hostgroup.(:view_hostgroups).find(params[:id]) rescue ActiveRecord::RecordNotFound => e not_found(e.) end |