Project

General

Profile

Bug #9531

Removing host name from Host#edit throws routing error

Added by Tomer Brisker over 3 years ago. Updated about 1 month ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Web Interface
Target version:
Difficulty:
Triaged:
Bugzilla link:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

Steps to reproduce:
1. edit an existing host
2. remove it's name
3. submit

Expected result: Validation Error

Actual result:

Routing Error: No route matches {:action=>"toggle_manage", :controller=>"hosts", :id=>#<Host::Managed id: 1013, name: "", last_compile: nil, last_freshcheck: nil, last_report: nil, updated_at: "2015-02-16 13:48:47", source_file_id: nil, created_at: "2015-02-16 13:48:47", root_pass: "$1$z6u2e8KR$10vMzAGljVnYOiVw1guYh0", serial: nil, puppet_status: 0, architecture_id: 1, operatingsystem_id: 1, environment_id: 1, ptable_id: 7, medium_id: 1, build: true, comment: "", disk: "", installed_at: nil, model_id: nil, hostgroup_id: nil, owner_id: 3, owner_type: "User", enabled: true, puppet_ca_proxy_id: nil, managed: true, use_image: nil, image_file: nil, uuid: nil, compute_resource_id: nil, puppet_proxy_id: nil, certname: nil, image_id: nil, organization_id: 2, location_id: 1, type: "Host::Managed", otp: nil, realm_id: nil, compute_profile_id: nil, provision_method: "build", grub_pass: "$1$a+UhzzpU$mFfRfr2wVfaYIPRlwhIws/">}

Related issues

Related to Foreman - Bug #4519: Renaming host with / in name causes "No route matches" errorClosed2014-03-03
Related to Foreman - Bug #12932: Update to 1.8.4 Bonded server cannot be modifiedResolved2015-12-23
Has duplicate Foreman - Bug #13853: Deleting name on existing host leads to routing errorDuplicate2016-02-23

Associated revisions

Revision adc931f2 (diff)
Added by Tomer Brisker over 1 year ago

Fixes #4519, #9531 - Correctly handle invalid host name changes

Removing a host name or otherwise changing it to an invalid name (such
as a name containing /) caused the form to fail loading. This makes sure
all paths are generated correctly and validation error is shown.

Revision 7f0c0c8e (diff)
Added by Tomer Brisker over 1 year ago

Fixes #4519, #9531 - Correctly handle invalid host name changes

Removing a host name or otherwise changing it to an invalid name (such
as a name containing /) caused the form to fail loading. This makes sure
all paths are generated correctly and validation error is shown.
(cherry picked from commit adc931f2107eaf14f095193a03ebad6dc10e4d22)

History

#1 Updated by Marek Hulán over 3 years ago

This is caused when rendering error and host name is '', we can't find the route. Here's the line causing problem https://github.com/theforeman/foreman/blob/96277f876959e1cd61c30cb8e28552e3183624da/app/controllers/application_controller.rb#L269

I'm not sure what's the best fix though. Reverting name (oneliner) would revert that in form as well but I'd expect the field to remain empty. Creating a clone object is tricky because of all other associations. This happens only when host name is set to empty string, so probably not a major issue.

#2 Updated by Shimon Shtein over 3 years ago

Client side validations?
We already have a pretty good validations on the server, why not promote them to the client (at least to some extent)?
[[https://github.com/DavyJonesLocker/client_side_validations]]
[[https://github.com/joecorcoran/judge]]

#3 Updated by Marek Hulán over 3 years ago

Oh, I'm glad someone took over the development of original client_side_validations gem after Brian Cardarella left it :-) If we stay with ERB then I vote for using this gem but it's quite big change which should be discussed first on mailing list and tracked as separate RFE. Also it does not solve the real issue, someone could still submit empty name, it's bug in server side.

#4 Updated by Dominic Cleal over 2 years ago

  • Related to Bug #4519: Renaming host with / in name causes "No route matches" error added

#5 Updated by Dominic Cleal over 2 years ago

  • Has duplicate Bug #13853: Deleting name on existing host leads to routing error added

#6 Updated by The Foreman Bot over 1 year ago

  • Status changed from New to Ready For Testing
  • Assignee set to Tomer Brisker
  • Pull request https://github.com/theforeman/foreman/pull/4179 added

#7 Updated by Tomer Brisker over 1 year ago

  • Bugzilla link set to 1408438

#8 Updated by Tomer Brisker over 1 year ago

  • Related to Bug #12932: Update to 1.8.4 Bonded server cannot be modified added

#9 Updated by Anonymous over 1 year ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#10 Updated by Dominic Cleal over 1 year ago

  • Legacy Backlogs Release (now unused) set to 210

#11 Updated by Daniel Lobato Garcia over 1 year ago

  • Target version set to 169

#12 Updated by Brad Buckingham over 1 year ago

  • Target version deleted (169)

#13 Updated by Daniel Lobato Garcia over 1 year ago

  • Target version set to 1.11.0

Also available in: Atom PDF