Bug #10642
closedMigration of unmanaged host can fail on primary interface
Description
If there's unmanaged host with interface that has IP set to it's primary interface but is not marked as primary the migration ends up in invalid state because db/migrate/20140910153654_move_host_nics_to_interfaces.rb creates new interface (skipping validations) with this IP and marks it primary. Then second migration - 20150508124600_copy_unmanaged_hosts_to_interfaces.rb - runs but here it finds the existing one from previous migration and tries to set it's hostname and save it. Unfortunately it's not FakeNic instance so it runs validations and fails on IP uniqueness validation. We can either try to skip saving of interface if it didn't change or improve detection of existing primary interface (probably in both migrations). Setting as release 1.8.2, all users with unmanaged hosts with interfaces created by puppet will hit this.
Migration error that pops up
== CopyUnmanagedHostsToInterfaces: migrating ================================= -- Migrating Unmanaged Host interfaces to standalone Interfaces rake aborted! An error has occurred, all later migrations canceled: Validation failed: IP address has already been taken
Updated by Marek Hulán over 9 years ago
- Related to Bug #10403: Smart Class Parameter Overrides using the FQDN fact as a match no longer applies the override added
Updated by Simon Mügge over 9 years ago
For us this issue blocks working around that issue: http://projects.theforeman.org/issues/10571
We should db:migrate to get rid of the LDAP issue (users can't log in) but we can't db:migrate because of all our unmanaged hosts and the migration breaking.
Updated by Marek Hulán over 9 years ago
- Related to Feature #10260: Allow interfaces management for unmanaged hosts added
Updated by The Foreman Bot over 9 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/2425 added
- Pull request deleted (
)
Updated by Marek Hulán over 9 years ago
The fix will make migration pass keeping interface in potentially invalid state. Invalid IP issue can then be changed through API (we can't do it automatically). Here's howto use API to fix that
# first find out the id of failing interface (identifier reported by migration) curl --user 'admin:$adminpw' 'https://$foreman_url/api/v2/hosts/$host_fqdn/interfaces' # update the interface identified by $id with real IP curl -X PUT -H 'Content-Type: application/json' --user 'admin:$adminpw' -d '{"interface":{"ip":"$real_ip"}}' 'https://$foreman_url/api/v2/hosts/$host_fqdn/interfaces/$id'
In related task I'll allow interface management from WebUI.
Updated by Marek Hulán over 9 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset 19d684ddf481c5ce8b30d234db28e8c336ccc272.
Updated by Marek Hulán over 9 years ago
- Related to Bug #10571: LDAP authentication management error added