Class: Mutations::AnsibleVariableOverrides::Update

Inherits:
UpdateMutation
  • Object
show all
Defined in:
app/graphql/mutations/ansible_variable_overrides/update.rb

Instance Method Summary collapse

Instance Method Details

#resolve(host_id:, ansible_variable_id:, **kwargs) ⇒ Object



17
18
19
20
21
22
23
# File 'app/graphql/mutations/ansible_variable_overrides/update.rb', line 17

def resolve(host_id:, ansible_variable_id:, **kwargs)
  result = super kwargs
  host = Host.find host_id
  vars = AnsibleVariable.where :id => ansible_variable_id
  resolver = ::ForemanAnsible::OverrideResolver.new(host, vars.pluck(:id))
  result.merge :overriden_ansible_variable => ::Presenters::OverridenAnsibleVariablePresenter.new(vars.first, resolver)
end