Bug #12441
closedDuplicate entries in `nics` table
Description
Foreman is inserting entires into the `nics` table during facts import/parse that have identical (host_id, identifier) columns as existing rows. This causes validation errors when trying to edit the host via the GUI.
Updated by Brandon Weeks almost 9 years ago
foreman=# SELECT id,identifier,mac,attrs,created_at FROM nics WHERE host_id = 690 AND identifier = 'br_tun' ORDER BY identifier;
id | identifier | mac | attrs | created_at
--------+------------+-------------------+---------------------------------------------------------+----------------------------
125 | br_tun | 92:60:6f:d8:23:4c | --- !ruby/hash:ActiveSupport::HashWithIndifferentAccess+| 2015-03-31 21:45:41.582826
| | | mtu: '1500' +|
| | | |
220002 | br_tun | ea:e5:ed:bd:a8:4a | --- !ruby/hash:ActiveSupport::HashWithIndifferentAccess+| 2015-11-10 20:52:03.44866
| | | mtu: '1500' +|
| | | lldp_neighbor_portdesc: '' +|
| | | lldp_neighbor_portid: '' +|
| | | lldp_neighbor_sysname: '' +|
| | | lldp_neighbor_mngaddr_ipv4: '' +|
| | | lldp_neighbor_mngaddr_ipv6: '' +|
| | | lldp_neighbor_pvid: '' +|
| | | lldp_neighbor_mtu: '' +|
| | | |
(2 rows)
foreman=#
example bad data
Updated by Brandon Weeks almost 9 years ago
host = Host::Managed.find(690)
macaddress_br_tun_fact_name = FactName.where(name: 'macaddress_br_tun').first
macaddress_br_tun_fact_value = FactValue.where(fact_name_id: macaddress_br_tun_fact_name, host_id: host).first
macaddress_br_tun_fact_value.value = 'aa:aa:aa:aa:aa:a1'
macaddress_br_tun_fact_value.save
host.populate_fields_from_facts
Test case to reproduce.
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/2902 added
Updated by Dominic Cleal almost 9 years ago
- Category changed from Database to Network
- Assignee set to Brandon Weeks
- Priority changed from Urgent to Normal
- Translation missing: en.field_release set to 71
Updated by Brandon Weeks almost 9 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset fedf37919ea9df65b40d39dc0387365d2c9e703d.
Updated by Marek Hulán about 8 years ago
- Related to Bug #15238: Multiple interfaces with empty identifier are marked as invalid added