mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
lib: nlcache: fix dry_run exception
Ticket: CM-28312 Testing Done: Test from the ticket error: link_set_bridge_info_data_dry_run() takes exactly 3 arguments (4 given) error: link_set_brport_with_info_slave_data_dry_run() got an unexpected keyword argument 'kind' seems like when updating a method, it's associated dry-run method wasn't updated accordingly. Maybe there is a way to programmatically check that I will look into it. warning: bridge: skipping port X invalid ether addr warning: interface not recognized - please check interface configuration Won't show on dry-run anymore Log info for commands executed with utils.exec_command() weren't prefixed with DRY-RUN. Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
This commit is contained in:
@ -1125,7 +1125,7 @@ class bridge(Addon, moduleBase):
|
||||
err += 1
|
||||
continue
|
||||
hwaddress = self.cache.get_link_address(bridgeport)
|
||||
if not self._valid_ethaddr(hwaddress):
|
||||
if not ifupdownflags.flags.DRYRUN and not self._valid_ethaddr(hwaddress):
|
||||
self.log_warn('%s: skipping port %s, ' %(ifaceobj.name,
|
||||
bridgeport) + 'invalid ether addr %s'
|
||||
%hwaddress)
|
||||
|
@ -1804,7 +1804,7 @@ class ifupdownMain:
|
||||
auto = False
|
||||
break
|
||||
|
||||
if auto and not os.path.exists("/sys/class/net/%s" % ifname):
|
||||
if not ifupdownflags.flags.DRYRUN and auto and not os.path.exists("/sys/class/net/%s" % ifname):
|
||||
self.logger.warning("%s: interface not recognized - please check interface configuration" % ifname)
|
||||
|
||||
def _get_filtered_ifacenames_with_classes(self, auto, allow_classes, excludepats, ifacenames):
|
||||
|
@ -289,10 +289,11 @@ class utils():
|
||||
|
||||
@classmethod
|
||||
def _log_command_exec(cls, cmd, stdin):
|
||||
dry_run = "DRY-RUN: " if ifupdownflags.flags.DRYRUN else ""
|
||||
if stdin:
|
||||
cls.logger.info('executing %s [%s]' % (cmd, stdin))
|
||||
cls.logger.info('%sexecuting %s [%s]' % (dry_run, cmd, stdin))
|
||||
else:
|
||||
cls.logger.info('executing %s' % cmd)
|
||||
cls.logger.info('%sexecuting %s' % (dry_run, cmd))
|
||||
|
||||
@classmethod
|
||||
def _format_error(cls, cmd, cmd_returncode, cmd_output, stdin):
|
||||
|
@ -2801,7 +2801,7 @@ class NetlinkListenerWithCache(nllistener.NetlinkManagerWithListener, BaseObject
|
||||
except Exception as e:
|
||||
raise Exception("%s: netlink: cannot create bridge or set attributes: %s" % (ifname, str(e)))
|
||||
|
||||
def link_set_bridge_info_data_dry_run(self, ifname, ifla_info_data):
|
||||
def link_set_bridge_info_data_dry_run(self, ifname, ifla_info_data, link_just_created):
|
||||
self.log_info_ifname_dry_run(ifname, "netlink: ip link add dev %s type bridge (with attributes)" % ifname)
|
||||
self.logger.debug("attributes: %s" % ifla_info_data)
|
||||
|
||||
@ -3054,7 +3054,7 @@ class NetlinkListenerWithCache(nllistener.NetlinkManagerWithListener, BaseObject
|
||||
except Exception as e:
|
||||
raise Exception("netlink: %s: cannot set %s (bridge slave) with options: %s" % (kind, ifname, str(e)))
|
||||
|
||||
def link_set_brport_with_info_slave_data_dry_run(self, ifname, _, __, ifla_info_slave_data):
|
||||
def link_set_brport_with_info_slave_data_dry_run(self, ifname, kind, ifla_info_data, ifla_info_slave_data):
|
||||
self.log_info_ifname_dry_run(ifname, "netlink: ip link set dev %s: bridge port attributes" % ifname)
|
||||
self.logger.debug("attributes: %s" % ifla_info_slave_data)
|
||||
|
||||
|
Reference in New Issue
Block a user