Revision d7c67746
Added by Michael Moll almost 6 years ago
app/models/hostgroup.rb | ||
---|---|---|
end
|
||
|
||
def inherited_lookup_value(key)
|
||
ancestors.reverse_each do |hg|
|
||
if (v = LookupValue.find_by(:lookup_key_id => key.id, :id => hg.lookup_values))
|
||
return v.value, hg.to_label
|
||
if key.path_elements.flatten.include?("hostgroup") && Setting["host_group_matchers_inheritance"]
|
||
ancestors.reverse_each do |hg|
|
||
if (v = LookupValue.find_by(:lookup_key_id => key.id, :id => hg.lookup_values))
|
||
return v.value, hg.to_label
|
||
end
|
||
end
|
||
end if key.path_elements.flatten.include?("hostgroup") && Setting["host_group_matchers_inheritance"]
|
||
end
|
||
[key.default_value, _("Default value")]
|
||
end
|
||
|
||
... | ... | |
private
|
||
|
||
def nested_root_pw
|
||
Hostgroup.sort_by_ancestry(ancestors).reverse_each do |a|
|
||
return a.root_pass if a.root_pass.present?
|
||
end if ancestry.present?
|
||
if ancestry.present?
|
||
Hostgroup.sort_by_ancestry(ancestors).reverse_each do |a|
|
||
return a.root_pass if a.root_pass.present?
|
||
end
|
||
end
|
||
nil
|
||
end
|
||
|
Also available in: Unified diff
Fixes #19873 - Fix Style/MultilineIfModifier cop (#5705)