int("255.255.255.0" does not work, fixes issue #33867 (#36271)

This commit is contained in:
ThomasADavis 2018-02-16 02:49:31 -08:00 committed by ansibot
parent 9018c63e56
commit f8b85bdbf3

View file

@ -180,7 +180,7 @@ class HostNetworksModule(BaseModule):
if not equal(network.get('gateway'), ip.ip.gateway):
ip.ip.gateway = network.get('gateway')
changed = True
if not equal(network.get('prefix'), int(ip.ip.netmask) if ip.ip.netmask else None):
if not equal(network.get('prefix'), sum([bin(int(x)).count('1') for x in ip.ip.netmask.split('.')]) if ip.ip.netmask else None):
ip.ip.netmask = str(network.get('prefix'))
changed = True