Class: Api::V2::AnsibleVariablesController
- Inherits:
-
BaseController
- Object
- BaseController
- Api::V2::AnsibleVariablesController
- Includes:
- Api::Version2, Foreman::Controller::Parameters::AnsibleVariable
- Defined in:
- app/controllers/api/v2/ansible_variables_controller.rb
Overview
API controller for Ansible Variables
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #import ⇒ Object
- #index ⇒ Object
- #obsolete ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Methods included from Foreman::Controller::Parameters::AnsibleVariable
Instance Method Details
#create ⇒ Object
57 58 59 60 |
# File 'app/controllers/api/v2/ansible_variables_controller.rb', line 57 def create @ansible_variable = AnsibleVariable.new(ansible_variable_params.merge(:imported => false)) process_response @ansible_variable.save end |
#destroy ⇒ Object
32 33 34 35 |
# File 'app/controllers/api/v2/ansible_variables_controller.rb', line 32 def destroy @ansible_variable.destroy render 'api/v2/ansible_variables/destroy' end |
#import ⇒ Object
75 76 77 78 79 80 |
# File 'app/controllers/api/v2/ansible_variables_controller.rb', line 75 def import Foreman::Deprecation.api_deprecation_warning(_('Use sync instead, to sync roles from Smart Proxy with Ansible feature enabled')) new_variables = @importer.import_variable_names([])[:new] new_variables.map(&:save) @imported = new_variables end |
#index ⇒ Object
26 27 28 |
# File 'app/controllers/api/v2/ansible_variables_controller.rb', line 26 def index @ansible_variables = resource_scope_for_index end |
#obsolete ⇒ Object
86 87 88 89 90 91 |
# File 'app/controllers/api/v2/ansible_variables_controller.rb', line 86 def obsolete Foreman::Deprecation.api_deprecation_warning(_('Use sync instead, to sync roles from Smart Proxy with Ansible feature enabled')) old_variables = @importer.import_variable_names([])[:obsolete] old_variables.map(&:destroy) @obsoleted = old_variables end |
#show ⇒ Object
21 |
# File 'app/controllers/api/v2/ansible_variables_controller.rb', line 21 def show; end |
#update ⇒ Object
66 67 68 69 |
# File 'app/controllers/api/v2/ansible_variables_controller.rb', line 66 def update @ansible_variable.update!(ansible_variable_params) render 'api/v2/ansible_variables/show' end |