From 42ae7838996bfeb91b6ea0a359d7c6a3e6427069 Mon Sep 17 00:00:00 2001 From: Sam Tannous Date: Thu, 19 May 2016 08:14:13 -0700 Subject: [PATCH] ifreload: address module always reconfigures (dels/adds) addresses when user Ticket: CM-8561 Reviewed By: kanna, julien Testing Done: Tested on amd64 switch ifreload always deletes and adds back a host IP address if that address is specified without a "/" and without a "netmask" config. The problem is fixed so that _inet_address_convert_to_cidr() handles a missing "/" and a missing "netmask" config. The host addresses is no longer added to a list of addresses we will del/add. The patch was simply to add a case for the missing "/" and a missing "netmask". --- addons/address.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/address.py b/addons/address.py index 1e1e601..660051a 100644 --- a/addons/address.py +++ b/addons/address.py @@ -153,6 +153,11 @@ class address(moduleBase): prefixlen = IPNetwork('%s' %addr + '/%s' %netmask).prefixlen newaddr = addr + '/%s' %prefixlen + else: + # we are here because there is no slash (/xx) and no netmask + # just let IPNetwork handle the ipv4 or ipv6 address mask + prefixlen = IPNetwork(addr).prefixlen + newaddr = addr + '/%s' %prefixlen newaddrs.append(newaddr) attrs = {}