Bug 1568872

Summary: python-netaddr: method IPAddress.netmask_bits() removed
Product: Red Hat Enterprise Linux 7 Reporter: Mauro Oddi <moddi>
Component: python-netaddrAssignee: François Cami <fcami>
Status: CLOSED WONTFIX QA Contact: Kaleem <ksiddiqu>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.5CC: fcami
Target Milestone: rc   
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: 2020-02-14 14:21:35 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:

Description Mauro Oddi 2018-04-18 10:55:33 UTC
Description of problem:
In the latest version of the python-netaddr library in RHEL the method IPAddress.netmask_bits() is not present, while in upstream version the method is available.

In the upstream changelog it is mentioned that the method was removed accidentally and re-added in version 0.7.11:

 - https://github.com/drkjam/netaddr/issues/38
 - http://netaddr.readthedocs.io/en/latest/changes.html#release-0-7-11

Link to the API:
 - https://netaddr.readthedocs.io/en/latest/api.html#netaddr.IPAddress.netmask_bits



Version-Release number of selected component (if applicable):
latest

How reproducible:
Always

Steps to Reproduce:
1. Install latest python-netaddr

# rpm -q  python-netaddr
python-netaddr-0.7.5-9.el7.noarch


2. Attempt to use method IPAddress.netmask_bits()

# python
Python 2.7.5 (default, May  3 2017, 07:55:04)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-14)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import netaddr
>>> ip = netaddr.IPAddress('1.1.1.1')
>>> ip
IPAddress('1.1.1.1')
>>> print ip
1.1.1.1
>>> dir(ip)
['__add__', '__and__', '__bool__', '__class__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__hex__', '__iadd__', '__index__', '__init__', '__int__', '__isub__', '__le__', '__long__', '__lshift__', '__lt__', '__module__', '__ne__', '__new__', '__nonzero__', '__oct__', '__or__', '__radd__', '__reduce__', '__reduce_ex__', '__repr__', '__rshift__', '__rsub__', '__setattr__', '__setstate__', '__sizeof__', '__slots__', '__str__', '__sub__', '__subclasshook__', '__xor__', '_module', '_set_value', '_value', 'bin', 'bits', 'format', 'info', 'ipv4', 'ipv6', 'is_hostmask', 'is_ipv4_compat', 'is_ipv4_mapped', 'is_link_local', 'is_loopback', 'is_multicast', 'is_netmask', 'is_private', 'is_reserved', 'is_unicast', 'key', 'packed', 'reverse_dns', 'sort_key', 'value', 'version', 'words']
>>> ip.netmask_bits()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'IPAddress' object has no attribute 'netmask_bits'
>>> q
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'q' is not defined
>>> quit()

3.

Actual results:


Expected results:


Additional info:

Comment 2 François Cami 2020-02-14 14:21:35 UTC
Fixing this bug was rejected for RHEL7. RHEL8 ships 0.7.19 which is not affected. Closing as WONTFIX.