Bug #2130
closednormalize_hostname appends domain to end of fqdn on Update
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
Updated by Mikael Fridh almost 12 years ago
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
Updated by Mikael Fridh almost 12 years ago
pullreq https://github.com/theforeman/foreman/pull/376 I opted for the single-dot patch.
Updated by Mikael Fridh almost 12 years ago
- 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!
Updated by Dominic Cleal over 11 years ago
- Status changed from New to Ready For Testing
- Assignee changed from Ohad Levy to Mikael Fridh
Updated by Mikael Fridh over 11 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset 0c8f532ed251049dcd93f6ce054f07093f9507f8.