Bug 1528377
| Summary: | subscription-manager register mixed case interface enPxpxsxfx facts missing mac address | ||
|---|---|---|---|
| Product: | Red Hat Satellite | Reporter: | Peter Vreman <peter.vreman> |
| Component: | Fact | Assignee: | satellite6-bugs <satellite6-bugs> |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Radovan Drazny <rdrazny> |
| Severity: | medium | Docs Contact: | |
| Priority: | high | ||
| Version: | 6.2.12 | CC: | inecas, mhulan |
| Target Milestone: | Unspecified | Keywords: | Triaged |
| Target Release: | Unused | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2019-06-05 14:35:53 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Bug Depends On: | |||
| Bug Blocks: | 1122832 | ||
|
Description
Peter Vreman
2017-12-21 16:23:49 UTC
Patch for 6.3Beta, on top of my other BZ https://bugzilla.redhat.com/show_bug.cgi?id=1528193 to fix bond slaves: --- /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.25/app/models/katello/rhsm_fact_parser.rb.171221-2 2017-12-21 09:42:52.734316952 +0000 +++ /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.25/app/models/katello/rhsm_fact_parser.rb 2017-12-21 16:11:25.214453420 +0000 @@ -21,16 +21,18 @@ end def get_facts_for_interface(interface) + # interface passed is normalized to lowercase, the rhsm fact can be mixed case, e.g. enPxpxsxfx + interfacekey=facts.keys.select { |f| f =~ /net\.interface\.#{interface}\.mac_address/i }.first().sub('net.interface.', '').sub('.mac_address', '') # if slave then permanent_mac_address contains the physical mac - if facts.has_key?("net.interface.#{interface}.permanent_mac_address") - mackey="net.interface.#{interface}.permanent_mac_address" + if facts.has_key?("net.interface.#{interfacekey}.permanent_mac_address") + mackey="net.interface.#{interfacekey}.permanent_mac_address" else - mackey="net.interface.#{interface}.mac_address" + mackey="net.interface.#{interfacekey}.mac_address" end { 'link' => true, 'macaddress' => facts[mackey], - 'ipaddress' => get_rhsm_ip(interface) + 'ipaddress' => get_rhsm_ip(interfacekey) } end Using the net.facts from above on a regular VM without patch gives: [Unknown Hilti Tier] root@li-lc-1578:~# sudo -u hoici hammer -c /opt/hoici/etc/sat6/hammer-hoici.yaml host interface list --host=li-lc-1442.hag.hilti.com ----|------------|--------------------------------|-------------------|---------------|------------------------- ID | IDENTIFIER | TYPE | MAC ADDRESS | IP ADDRESS | DNS NAME ----|------------|--------------------------------|-------------------|---------------|------------------------- 56 | eth1 | interface | 00:50:56:97:4c:ee | 192.168.123.3 | 55 | eth0 | interface (primary, provision) | 00:50:56:97:74:4b | 10.92.14.90 | li-lc-1442.hag.hilti.com 57 | eth2 | interface | 00:50:56:97:48:50 | | 664 | enp3p3s0f1 | interface | | | ----|------------|--------------------------------|-------------------|---------------|------------------------- With patch: [Unknown Hilti Tier] root@li-lc-1578:~# sudo -u hoici hammer -c /opt/hoici/etc/sat6/hammer-hoici.yaml host interface list --host=li-lc-1442.hag.hilti.com ----|------------|--------------------------------|-------------------|---------------|------------------------- ID | IDENTIFIER | TYPE | MAC ADDRESS | IP ADDRESS | DNS NAME ----|------------|--------------------------------|-------------------|---------------|------------------------- 668 | enp3p4s0f1 | interface | 99:99:ed:57:2b:f4 | | 669 | enp3p4s0f0 | interface | 99:99:ed:6f:1e:84 | | 56 | eth1 | interface | 00:50:56:97:4c:ee | 192.168.123.3 | 55 | eth0 | interface (primary, provision) | 00:50:56:97:74:4b | 10.92.14.90 | li-lc-1442.hag.hilti.com 670 | enp3p3s0f0 | interface | 99:99:ed:57:1f:04 | | 57 | eth2 | interface | 00:50:56:97:48:50 | | 671 | enp3p3s0f1 | interface | 99:99:ed:57:1f:05 | 192.168.2.1 | ----|------------|--------------------------------|-------------------|---------------|------------------------- [Unknown Hilti Tier] root@li-lc-1578:~# Patch for 6.2.z
--- $ktdir/app/models/katello/rhsm_fact_parser.rb
+++ $ktdir/app/models/katello/rhsm_fact_parser.rb
@@ -20,16 +20,18 @@
end
def get_facts_for_interface(interface)
+ # interface passed is normalized to lowercase, the rhsm fact can be mixed case, e.g. enPxpxsxfx
+ interfacekey=facts.keys.select { |f| f =~ /net\.interface\.#{interface}\.mac_address/i }.first().sub('net.interface.', '').sub('.mac_address', '')
# if slave then permanent_mac_address contains the physical mac
- if facts.has_key?("net.interface.#{interface}.permanent_mac_address")
- mackey="net.interface.#{interface}.permanent_mac_address"
+ if facts.has_key?("net.interface.#{interfacekey}.permanent_mac_address")
+ mackey="net.interface.#{interfacekey}.permanent_mac_address"
else
- mackey="net.interface.#{interface}.mac_address"
+ mackey="net.interface.#{interfacekey}.mac_address"
end
{
'link' => true,
'macaddress' => facts[mackey],
- 'ipaddress' => facts["net.interface.#{interface}.ipv4_address"]
+ 'ipaddress' => facts["net.interface.#{interfacekey}.ipv4_address"]
}
end
Steps to Reproduce: 1. provision a simple VM 2. Edit /etc/sysconfig/grub, add "net.ifnames=0 biosdevname=0" to GRUB_CMDLINE_LINUX 3. Rename /etc/sysconfig/network-scripts/ifcfg-eth0 to ifcfg-enP3p1s0f0, change interface names and add correct MAC address -NAME="eth0" +NAME="enP3p1s0f0" -DEVICE="eth0" +DEVICE="eth0" +HWADDR="00:00:00:00:00:01" 4. reboot 5. register host to Satellite 6. Check interface page after Puppet run With 6.5.0 the problem is gone due with the facter structured data reporting correctly interface names using Uppercase letters |