Revision a406cf2b
Added by Matěj Mudra 8 months ago
test/models/lookup_value_test.rb | ||
---|---|---|
end
|
||
end
|
||
|
||
test "can create lookup value if match fqdn= does match existing host" do
|
||
as_admin do
|
||
Setting[:append_domain_name_for_hosts] = false
|
||
domain = FactoryBot.create(:domain)
|
||
host = FactoryBot.create(:host, interfaces: [FactoryBot.build(:nic_managed, identifier: 'fqdn_test', primary: true, domain: domain)])
|
||
attrs = { :match => "fqdn=#{host.primary_interface.fqdn}", :value => "123", :lookup_key_id => lookup_key.id }
|
||
refute_match /#{domain.name}/, host.name, "#{host.name} shouldn't be FQDN"
|
||
assert_difference('LookupValue.count') do
|
||
LookupValue.create!(attrs)
|
||
end
|
||
end
|
||
end
|
||
|
||
test "can create lookup value if user has matching hostgroup " do
|
||
attrs = valid_attrs2 # create key outside as_user
|
||
as_user :one do
|
Also available in: Unified diff
fixes #36160 - Redefine append domain names setting
This PR aims to unify the format of host names stored in the database and the way they are displayed.
With this change, the name of the host is always going to be stored with the domain name appended.
The setting formerly named `append_domain_name_for_hosts` is now renamed to `display_fqdn_for_hosts`
because it will only impact how the names are displayed from now.
This means dashboards and breadcrumbs are going to display the whole FQDN if you choose to.