1
0
mirror of https://github.com/CumulusNetworks/ifupdown2.git synced 2024-05-06 15:54:50 +00:00

addons: vxlan: attr vxlan-port: add DRYRUN check

-n sets DRYRUN flags, when DRYRUN is set many functions return True
(like link_exists), in this case vxlanattrs is set to False because
not cached. But since link_exists=True we still try to access it like
a dictionary.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
This commit is contained in:
Julien Fortin
2018-10-26 18:48:49 +02:00
parent cd890b06e4
commit 3fb83a7ab6

View File

@ -10,6 +10,7 @@ from ipaddr import IPNetwork, IPv4Address, IPv4Network, AddressValueError
try:
import ifupdown2.ifupdown.policymanager as policymanager
import ifupdown2.ifupdown.ifupdownflags as ifupdownflags
from ifupdown2.nlmanager.nlmanager import Link
@ -21,6 +22,7 @@ try:
from ifupdown2.ifupdownaddons.modulebase import moduleBase
except ImportError:
import ifupdown.policymanager as policymanager
import ifupdown.ifupdownflags as ifupdownflags
from nlmanager.nlmanager import Link
@ -290,7 +292,7 @@ class vxlan(moduleBase):
self.logger.warning('%s: vxlan-port: using default %s: invalid configured value %s' % (ifname, netlink.VXLAN_UDP_PORT, str(e)))
vxlan_port = netlink.VXLAN_UDP_PORT
if link_exists:
if link_exists and not ifupdownflags.flags.DRYRUN:
cache_port = vxlanattrs.get(Link.IFLA_VXLAN_PORT)
if vxlan_port != cache_port:
self.logger.warning('%s: vxlan-port (%s) cannot be changed - to apply the desired change please run: ifdown %s && ifup %s'