Bug #13158
closedError updating host name after removing primary interface flag
Description
Hello
While testing the new "Interfaces" web UI, I removed both Primary and Provisioning tags from the only interface for the host.
I clicked Submit. All seemed OK, although I was expecting the system to complain.
I then tried to reapply the Primary and Provisioning tags and got this error:
Warning!
Host::Base#name= delegated to primary_interface.name=, but primary_interface is nil: #<Host::Managed id: 1, name: "ad-foreman", last_compile: "2016-01-12 05:04:08", last_report: "2016-01-12 05:04:06", updated_at: "2016-01-12 05:20:33", created_at: "2015-11-21 21:42:40", root_pass: nil, puppet_status: 100663296, architecture_id: 1, operatingsystem_id: 1, environment_id: 1, ptable_id: nil, medium_id: nil, build: false, comment: "", disk: nil, installed_at: nil, model_id: 1, hostgroup_id: nil, owner_id: 3, owner_type: "User", enabled: true, puppet_ca_proxy_id: 1, managed: false, use_image: nil, image_file: nil, uuid: nil, compute_resource_id: nil, puppet_proxy_id: 1, certname: "ad-foreman.redhat.com", image_id: nil, organization_id: nil, location_id: nil, type: "Host::Managed", otp: nil, realm_id: nil, compute_profile_id: nil, provision_method: nil, grub_pass: "">
= =
Thank you
Files
Updated by Stephen Wadeley almost 9 years ago
Run time error text
Updated by Stephen Wadeley almost 9 years ago
Please edit the subject, seems I do not have the permissions required: s/anf/and/
Thank you
Updated by Dominic Cleal almost 9 years ago
- Subject changed from Error when removing anf adding tags to interface to Error updating host name after removing primary interface flag
- Category set to Network
Not sure how you managed to remove the primary flag, frankly. It ought to be validated.
Updated by Stephen Wadeley almost 9 years ago
Now I cannot add any tags without getting an error when I click Submit.
Updated by Stephen Wadeley almost 9 years ago
BTW, I noticed "Provision" next to the check box while it is "Provisioning" for the icon label.
Updated by Marek Hulán almost 9 years ago
Updated by Stephen Wadeley almost 9 years ago
Hello
The host was unmanaged, but setting it to managed does not stop the error now. I have asked for update and restart of the test VM.
Thank you
Updated by Stephen Wadeley almost 9 years ago
Hello
I built new test VM and I confirm error does not occur in Version 1.10.0. Now it just discards the changes (but without telling you).
Thank you
Updated by Diego Lucas over 8 years ago
Stephen Wadeley wrote:
Hello
I built new test VM and I confirm error does not occur in Version 1.10.0. Now it just discards the changes (but without telling you).
Thank you
I have a Foreman 1.10.2 and the error still there.
I needed to manually edit the DB to correct it.
Updated by Stefan Lasiewski over 8 years ago
This is still happening with Foreman 1.11.3.
Here are some details:
1. Our hosts were created previous to Foreman 1.10.0. We've since upgraded to Foreman 1 .11.3.
2. In some cases, we used the Discovery Plugin previous to provisioning the hosts.
3. The network configuration was generally changed outside of Puppet or Foreman.
4. This happens on a variety of hosts with a variety of network connections-- Bonded or not, eth0 as primary or not; some have network aliases, others don't.
5. The one common factor is that we remove the 'primary' flag from an interface, and then hit save. Afterwards we are unable to perform many tasks because Foreman or Hammer continually complain with an error like `Host::Base#name= delegated to primary_interface.name=, but primary_interface is nil`.
Any workarounds, or steps to fix in the database, would be appreciated.
Updated by Daniel Lobato Garcia over 8 years ago
Stefan,
5. The one common factor is that we remove the 'primary' flag from an interface, and then hit save. Afterwards we are unable to perform many tasks because Foreman or Hammer continually complain with an error like `Host::Base#name= delegated to primary_interface.name=, but primary_interface is nil`.
I assume you were able to do that before 1.11 but not now, right?
If you want a workaround, you can run `foreman-rake console` , then something like
Host.find_by_name("fqdnofyourhost").interfaces[0].update_attribute(:primary, true)Substitute 0 for the interface you want to fix
Updated by Stefan Lasiewski over 8 years ago
I assume you were able to do that before 1.11 but not now, right?
No, we had the same problems with Foreman 1.9 and even earlier versions.
If you want a workaround, you can run `foreman-rake console`
Thanks. I'm not super familiar with the rake console, but this helped me to force values to sane values.
Updated by Marek Hulán over 7 years ago
- Status changed from New to Resolved
Thanks for confirmation, I'm marking as resolved. Please let us know if there's something else required.