Project

General

Profile

Actions

Bug #5643

closed

Host save fails if name contains underscore with Failed to save: Name is invalid

Added by kan au almost 10 years ago. Updated over 6 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Hi,
Today I add existing host to foreman which I can see this host show on the foreman dashboard. But when I edit the host on any entry I can't submit any change, it show the error at the field "Name" as invalid.

Here is the production.log

Started PUT "/hosts/tt2-ralph" for at 2014-05-09 11:26:10 +0700
Processing by HostsController#update as */*
Parameters: {"utf8"=>"✓", "authenticity_token"=>"xAJilYtqRc0ZoFlAhPhDCnm5tiWOtBzAfxgeo8aJNIs=", "host"=>{"name"=>"tt2-ralph", "hostgroup_id"=>"", "environment_id"=>"1", "puppet_ca_proxy_id"=>"1", "puppet_proxy_id"=>"1", "puppetclass_ids"=>[""], "managed"=>"f", "progress_report_id"=>"[FILTERED]", "is_owned_by"=>"1-Users", "enabled"=>"1", "model_id"=>"1", "comment"=>"", "overwrite"=>"false"}, "id"=>"tt2-ralph"}
Failed to save: Name is invalid
Rendered hosts/_progress.html.erb (0.2ms)
Rendered puppetclasses/_selectedClasses.html.erb (0.0ms)
Rendered puppetclasses/_classes_in_groups.html.erb (0.0ms)
Rendered puppetclasses/_classes.html.erb (5.0ms)
Rendered puppetclasses/_class_selection.html.erb (35.0ms)
Rendered puppetclasses/_class_parameters.html.erb (0.0ms)
Rendered puppetclasses/_classes_parameters.html.erb (11.1ms)
Rendered common_parameters/_inherited_parameters.html.erb (0.4ms)
Rendered common_parameters/_puppetclass_parameter.html.erb (4.5ms)
Rendered common_parameters/_puppetclasses_parameters.html.erb (7.1ms)
Rendered common_parameters/_parameter.html.erb (2.8ms)
Rendered common_parameters/_parameters.html.erb (8.2ms)
Rendered hosts/_form.html.erb (118.7ms)
Rendered hosts/edit.html.erb within layouts/application (122.2ms)
Rendered home/_user_dropdown.html.erb (2.5ms)
Read fragment views/tabs_and_title_records-1 (0.2ms)
Rendered home/_topbar.html.erb (4.3ms)
Rendered layouts/base.html.erb (6.9ms)
Completed 200 OK in 197ms (Views: 119.4ms | ActiveRecord: 23.9ms)

  1. rpm -qa|grep -i foreman
    ruby193-rubygem-foreman_bootdisk-2.0.5-1.el6.noarch
    ruby193-rubygem-foreman_setup-2.0.3-1.el6.noarch
    foreman-proxy-1.5.0-0.2.RC2.el6.noarch
    foreman-postgresql-1.5.0-0.2.RC2.el6.noarch
    rubygem-foreman_api-0.1.11-1.el6.noarch
    foreman-1.5.0-0.2.RC2.el6.noarch
    foreman-release-1.5.0-0.2.RC2.el6.noarch
    foreman-installer-1.5.0-0.2.RC2.el6.noarch
  1. rpm -qa|grep -i puppet
    puppet-3.5.1-1.el6.noarch
    puppet-server-3.5.1-1.el6.noarch

I add this host to the foreman by add the line server=<myforemanserver> at the puppet.conf and run puppet agent --test.
Also start the puppet agent on the client.

Regards,
Kan


Files

Name_is_invalid_screenshot.png View Name_is_invalid_screenshot.png 28.4 KB UI screenshot for "Failed to save: Name is invalid" Alex Nothing, 02/19/2015 05:24 AM
Actions #1

Updated by Lukas Zapletal almost 10 years ago

Hmmm check all the associated records like smart-proxies etc. Try to update them without any change.

Actions #2

Updated by Alex Nothing about 9 years ago

Hello, I've run into absolutely the same issue.

While trying to save (even without any changes) host - I'm receiving "Name blabla.mbla.lbla is invalid." in UI.

Foreman log:
Started PUT "/hosts/blabla.mbla.lbla" for 10.0.1.12 at 2015-02-19 13:13:11 +0300
Processing by HostsController#update as */

Parameters: {"utf8"=>"✓", "authenticity_token"=>"DN99A78ikCeC4cXDmiVsKMF3hnhtf2NKX9V4AOF8cX4=", "host"=>{"name"=>"blabla.mbla.lbla", "hostgroup_id"=>"", "environment_id"=>"1", "puppet_ca_proxy_id"=>"1", "puppet_proxy_id"=>"4", "puppetclass_ids"=>[""], "managed"=>"0", "progress_report_id"=>"[FILTERED]", "is_owned_by"=>"3-Users", "enabled"=>"1", "model_id"=>"2", "comment"=>"", "overwrite"=>"false"}, "id"=>"blabla.mbla.lbla"}
Failed to save: Name is invalid
Rendered hosts/_progress.html.erb (0.1ms)
Rendered puppetclasses/_selectedClasses.html.erb (0.0ms)
Rendered puppetclasses/_classes_in_groups.html.erb (0.0ms)
Rendered puppetclasses/_classes.html.erb (2.4ms)
Rendered puppetclasses/_class_selection.html.erb (17.2ms)
Rendered puppetclasses/_class_parameters.html.erb (0.0ms)
Rendered puppetclasses/_classes_parameters.html.erb (5.6ms)
Rendered common_parameters/_inherited_parameters.html.erb (0.2ms)
Rendered common_parameters/_puppetclass_parameter.html.erb (2.9ms)
Rendered common_parameters/_puppetclasses_parameters.html.erb (4.1ms)
Rendered common_parameters/_parameter.html.erb (1.4ms)
Rendered common_parameters/_parameters.html.erb (3.1ms)
Rendered hosts/_form.html.erb (64.6ms)
Rendered hosts/edit.html.erb within layouts/application (66.7ms)
Rendered home/_user_dropdown.html.erb (1.5ms)
Read fragment views/tabs_and_title_records-3 (0.2ms)
Rendered home/_topbar.html.erb (2.5ms)
Rendered layouts/base.html.erb (3.9ms)
Completed 200 OK in 116ms (Views: 61.8ms | ActiveRecord: 20.0ms) *

Hostname is like "[\w\d\_]+\.[\w\d\_]+\.[\w\d\_]+" , where last 2 parts are domain name.
UI screenshot is attached.
Foreman version is 1.7.2.

Actions #3

Updated by Alex Nothing about 9 years ago

Meanwhile, I can edit and save other hsots, which names don't contain underscore (_) symbol.

Actions #4

Updated by Alex Nothing about 9 years ago

Resolved by amending /usr/share/foreman/lib/net/validations.rb respectively.

Actions #5

Updated by Marek Hulán almost 9 years ago

  • Subject changed from Failed to save: Name is invalid to Host save fails if name contains underscore with Failed to save: Name is invalid
Actions #6

Updated by David Barbion over 8 years ago

Hello, same issue here.

I've got bunch of hosts with _ in there names. However, it does not match the official DNS name which do not have _.
I think _ should be allowed in hostname.

Additionally, Foreman's host name is derived from puppet certname which use hostname and domain facts.

Actions #7

Updated by Amir Barkal about 8 years ago

Same issue here with 1.9.2.

I'm going to change "HOST_REGEXP" in /usr/share/foreman/lib/net/validations.rb to allow underscores in host names.
Are there any unexpected consequences to this move?

Thanks.

Actions #8

Updated by Tomer Brisker over 6 years ago

  • Status changed from New to Rejected

Underscores are not valid characters for hostnames: http://www.ietf.org/rfc/rfc1123.txt
Closing as rejected.

Actions

Also available in: Atom PDF