Class: Api::V2::AnsibleOverrideValuesController
- Inherits:
-
BaseController
- Object
- BaseController
- Api::V2::AnsibleOverrideValuesController
- Includes:
- Api::Version2, Foreman::Controller::Parameters::AnsibleOverrideValue
- Defined in:
- app/controllers/api/v2/ansible_override_values_controller.rb
Overview
API controller for Ansible Roles
Instance Method Summary collapse
Methods included from Foreman::Controller::Parameters::AnsibleOverrideValue
Instance Method Details
#create ⇒ Object
26 27 28 29 30 31 32 |
# File 'app/controllers/api/v2/ansible_override_values_controller.rb', line 26 def create @ansible_variable = AnsibleVariable.(:edit_ansible_variables). find_by(:id => params[:ansible_variable_id].to_i) @override_value = @ansible_variable.lookup_values.create!(lookup_value_params['override_value']) @ansible_variable.update_attribute(:override, true) render 'api/v2/ansible_override_values/show' end |
#destroy ⇒ Object
54 55 56 57 58 59 60 61 62 63 |
# File 'app/controllers/api/v2/ansible_override_values_controller.rb', line 54 def destroy @override_value = LookupValue.find_by(:id => params[:id]) if @override_value @ansible_variable = AnsibleVariable.where(:id => @override_value.lookup_key_id) @override_value.destroy render 'api/v2/ansible_override_values/show' else not_found end end |
#resource_name ⇒ Object
65 66 67 |
# File 'app/controllers/api/v2/ansible_override_values_controller.rb', line 65 def resource_name 'ansible_variable' end |
#update ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/controllers/api/v2/ansible_override_values_controller.rb', line 38 def update @ansible_variable = AnsibleVariable.(:edit_ansible_variables). find_by(:id => params[:id].to_i) @override_value = @ansible_variable.lookup_values.find_by(:match => lookup_value_params['override_value']['match']) if @override_value @override_value.update(lookup_value_params['override_value']) render 'api/v2/ansible_override_values/show' else not_found end end |