Project

General

Profile

Actions

Bug #10642

closed

Migration of unmanaged host can fail on primary interface

Added by Marek Hulán almost 9 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
DB migrations
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

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


Related issues 3 (0 open3 closed)

Related to Foreman - Bug #10403: Smart Class Parameter Overrides using the FQDN fact as a match no longer applies the overrideClosedDominic Cleal05/06/2015Actions
Related to Foreman - Feature #10260: Allow interfaces management for unmanaged hostsClosedMarek Hulán04/24/2015Actions
Related to Foreman - Bug #10571: LDAP authentication management errorResolved05/21/2015Actions
Actions #1

Updated by Marek Hulán almost 9 years ago

  • Related to Bug #10403: Smart Class Parameter Overrides using the FQDN fact as a match no longer applies the override added
Actions #2

Updated by Simon Mügge almost 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.

Actions #3

Updated by Marek Hulán almost 9 years ago

  • Related to Feature #10260: Allow interfaces management for unmanaged hosts added
Actions #4

Updated by The Foreman Bot almost 9 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/2425 added
  • Pull request deleted ()
Actions #5

Updated by Marek Hulán almost 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.

Actions #6

Updated by Marek Hulán almost 9 years ago

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

Updated by Marek Hulán almost 9 years ago

  • Related to Bug #10571: LDAP authentication management error added
Actions

Also available in: Atom PDF