Sha256: 6e96b3576815e00614764fbcc91585f6a7b52a473881d37c4f20b9db1cb0c036
Contents?: true
Size: 848 Bytes
Versions: 58
Compression:
Stored size: 848 Bytes
Contents
module ForemanAnsible # Service which resolves override values for hosts class OverrideResolver attr_reader :overrides, :ansible_variables def initialize(host, variable_ids = []) raise(Foreman::Exception.new('OverrideResolver needs a host to resolve overrides')) unless host @ansible_variables = if variable_ids.empty? AnsibleVariable.where(:ansible_role_id => host.all_ansible_roles, :override => true) else AnsibleVariable.where(:id => variable_ids, :override => true) end @overrides = @ansible_variables.values_hash(host).raw end def resolve(ansible_variable) override = @overrides[ansible_variable.id] return unless override override[ansible_variable.key] end end end
Version data entries
58 entries across 58 versions & 1 rubygems