14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'app/graphql/mutations/ansible_variable_overrides/delete.rb', line 14
def resolve(id:, host_id:, variable_id:)
host = Host.find_by :id => host_id
variable = AnsibleVariable.find_by :id => variable_id
return resource_not_found(_('Host not found by id: %s'), host_id) unless host
return resource_not_found(_('Ansible Variable not found by id: %s'), variable_id) unless variable
authorize!(host, :view)
authorize!(variable, :edit)
result = super id: id
resolver = ::ForemanAnsible::OverrideResolver.new(host, [variable.id])
result.merge :overriden_ansible_variable => ::Presenters::OverridenAnsibleVariablePresenter.new(variable, resolver)
end
|