Bug 1477149

Summary: rhn-profile-sync stores incorrect ipv6 network mask in hardware profile and raises ValueError on F26
Product: [Community] Spacewalk Reporter: Ales Dujicek <adujicek>
Component: ClientsAssignee: Gennadii Altukhov <galtukho>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 2.6CC: eherget, galtukho, tlestach
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-09-27 19:37:03 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: 1310034, 1484117    

Description Ales Dujicek 2017-08-01 10:53:16 UTC
Description of problem:

I added some ipv6 addresses with custom masks to a network interface
# ip a
....
    inet6 b023::75/75 scope global 
       valid_lft forever preferred_lft forever
    inet6 b023::71/71 scope global 
       valid_lft forever preferred_lft forever

but after profile sync it has wrong netmasks in its profile:
# rhn-profile-sync 

System > Details > Hardware
Interface	IPv6 Address	Netmask
ens3	b023::71	73
ens3	b023::75	69


and on Fedora 26 rhn-profile-sync does not work because netifaces output has changed
>>> import netifaces
>>> interfaces = netifaces.interfaces()
>>> for interface in interfaces:
...   netifaces.ifaddresses(interface)[netifaces.AF_INET6]
... 
[{'addr': '::1', 'netmask': 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/128'}]
[{'addr': '2620:52:0:2224:5054:ff:fe87:ced6', 'netmask': 'ffff:ffff:ffff:ffff::/64'}, {'addr': 'fe80::5054:ff:fe87:ced6%ens3', 'netmask': 'ffff:ffff:ffff:ffff::/64'}]

# rhn-profile-sync 
Updating package profile...
Updating hardware profile...
Error reading network interface information: <class 'ValueError'>

Traceback (most recent call last):
  File "/usr/sbin/rhn-profile-sync", line 59, in <module>
    cli.run()
  File "/usr/share/rhn/up2date_client/rhncli.py", line 96, in run
    sys.exit(self.main() or 0)
  File "/usr/sbin/rhn-profile-sync", line 50, in main
    rhnHardware.updateHardware()
  File "/usr/share/rhn/up2date_client/rhnHardware.py", line 10, in updateHardware
    hardwareList = hardware.Hardware()
  File "/usr/share/rhn/up2date_client/hardware.py", line 941, in Hardware
    ret = read_network_interfaces()
  File "/usr/share/rhn/up2date_client/hardware.py", line 741, in read_network_interfaces
    netmask_bits += 16 - 1 - bin(int(two_octets, 16))[2:].rindex('1')
<class 'ValueError'>: invalid literal for int() with base 16: 'ffff/128'


Version-Release number of selected component (if applicable):
rhn-client-tools-2.7.11-1.fc26.noarch

How reproducible:
always

Steps to Reproduce:
1. add ipv6 address with custom mask
2. rhn-profile-sync
3. check System > Details > Hardware

Comment 1 Ales Dujicek 2017-08-01 10:57:38 UTC
pull request with fix
https://github.com/spacewalkproject/spacewalk/pull/562

Comment 2 Gennadii Altukhov 2017-08-02 09:52:31 UTC
The bug is fixed in upstream. spacewalk.git:
5de531d7ca6a11b746e326fd6b25d73e1a6e093d

Comment 3 Tomáš Kašpárek 2017-08-04 08:53:12 UTC
*** Bug 1477604 has been marked as a duplicate of this bug. ***

Comment 4 Eric Herget 2017-09-27 19:37:03 UTC
Spacewalk 2.7 has been released.

https://github.com/spacewalkproject/spacewalk/wiki/ReleaseNotes27