Bug #2130
closed
normalize_hostname appends domain to end of fqdn on Update
Added by Mikael Fridh almost 12 years ago.
Updated over 11 years ago.
Description
So, not sure if this is just my freaky environment, where I have hosts whose fqdn really is:
willy.freaky.com
but they have a hardcoded fqdn in puppet as:
willy.deaky.net
From Foreman and Puppets point of view, the hosts are named *.deaky.net.
When editing a Host, the normalize_hostname filter will append $domain
to the end of the fqdn, thus renaming the host:
willy.deaky.net.freaky.com
I'm thinking either this patch, or simply matching one dot /\./
diff --git a/app/models/host.rb b/app/models/host.rb
index fcb8838..9e81b9a 100644
--- a/app/models/host.rb
+++ b/app/models/host.rb
@@ -819,7 +819,7 @@ class Host < Puppet::Rails::Host
old_domain = Domain.find(changed_attributes["domain_id"])
self.name.gsub(old_domain.to_s,"")
end
- self.name += ".#{domain}" unless name =~ /.#{domain}$/i
+ self.name += ".#{domain}" unless name =~ /\..*\./i
end
end
- Target version set to 1.2.0
I'll just set this to 1.2 for consideration as there was some agreement on #theforeman-dev that the patch does make some sense. Why should hosts be renamed if they already look like an fqdn style hostname. I'm unaware of an edge case where it would make sense but please enlighten me if you do!
- Status changed from New to Ready For Testing
- Assignee changed from Ohad Levy to Mikael Fridh
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Also available in: Atom
PDF