From c46af1c9921ce154e7639207ab59990ceb1125f7 Mon Sep 17 00:00:00 2001 From: Julien Fortin Date: Mon, 9 Dec 2019 22:31:46 +0100 Subject: [PATCH] python3: logging: the 'warn' method is deprecated, use warning instead Signed-off-by: Julien Fortin --- ifupdown2/addons/address.py | 10 +++---- ifupdown2/addons/addressvirtual.py | 2 +- ifupdown2/addons/bond.py | 4 +-- ifupdown2/addons/bridge.py | 16 +++++------ ifupdown2/addons/bridgevlan.py | 6 ++--- ifupdown2/addons/mstpctl.py | 4 +-- ifupdown2/addons/usercmds.py | 2 +- ifupdown2/addons/vrf.py | 12 ++++----- ifupdown2/addons/vrrpd.py | 4 +-- ifupdown2/ifupdown/ifupdownmain.py | 36 ++++++++++++------------- ifupdown2/ifupdown/networkinterfaces.py | 10 +++---- ifupdown2/ifupdown/scheduler.py | 12 ++++----- ifupdown2/ifupdown/template.py | 4 +-- ifupdown2/ifupdownaddons/modulebase.py | 10 +++---- ifupdown2/ifupdownaddons/mstpctlutil.py | 2 +- ifupdown2/ifupdownaddons/utilsbase.py | 2 +- ifupdown2/lib/io.py | 2 +- ifupdown2/lib/iproute2.py | 8 +++--- 18 files changed, 73 insertions(+), 73 deletions(-) diff --git a/ifupdown2/addons/address.py b/ifupdown2/addons/address.py index a2df24d..7b172ba 100644 --- a/ifupdown2/addons/address.py +++ b/ifupdown2/addons/address.py @@ -633,7 +633,7 @@ class address(Addon, moduleBase): retval = True if (ifaceobj.link_kind & ifaceLinkKind.BRIDGE): if syntaxcheck: - self.logger.warn('%s: bridge inherits mtu from its ports. There is no need to assign mtu on a bridge' %ifaceobj.name) + self.logger.warning('%s: bridge inherits mtu from its ports. There is no need to assign mtu on a bridge' %ifaceobj.name) retval = False else: self.logger.info('%s: bridge inherits mtu from its ports. There is no need to assign mtu on a bridge' %ifaceobj.name) @@ -648,7 +648,7 @@ class address(Addon, moduleBase): "There is no need to configure mtu on a bond slave." % (ifaceobj.name, mtu_str, masterobj[0].name, master_mtu)) if syntaxcheck: - self.logger.warn(log_msg) + self.logger.warning(log_msg) retval = False else: self.logger.info(log_msg) @@ -661,18 +661,18 @@ class address(Addon, moduleBase): else: lowerdev_mtu = self.cache.get_link_mtu(lowerobj[0].name) # return type: int if lowerdev_mtu and mtu_int > lowerdev_mtu: - self.logger.warn('%s: vlan dev mtu %s is greater than lower realdev %s mtu %s' + self.logger.warning('%s: vlan dev mtu %s is greater than lower realdev %s mtu %s' %(ifaceobj.name, mtu_str, lowerobj[0].name, lowerdev_mtu)) retval = False elif (not lowerobj[0].link_kind and not (lowerobj[0].link_privflags & ifaceLinkPrivFlags.LOOPBACK) and not lowerdev_mtu and self.default_mtu and (mtu_int > self.default_mtu_int)): # only check default mtu on lower device which is a physical interface - self.logger.warn('%s: vlan dev mtu %s is greater than lower realdev %s mtu %s' + self.logger.warning('%s: vlan dev mtu %s is greater than lower realdev %s mtu %s' %(ifaceobj.name, mtu_str, lowerobj[0].name, self.default_mtu)) retval = False if self.max_mtu and mtu_int > self.max_mtu: - self.logger.warn('%s: specified mtu %s is greater than max mtu %s' + self.logger.warning('%s: specified mtu %s is greater than max mtu %s' %(ifaceobj.name, mtu_str, self.max_mtu)) retval = False return retval diff --git a/ifupdown2/addons/addressvirtual.py b/ifupdown2/addons/addressvirtual.py index 97e6563..f996e48 100644 --- a/ifupdown2/addons/addressvirtual.py +++ b/ifupdown2/addons/addressvirtual.py @@ -1000,7 +1000,7 @@ class addressvirtual(Addon, moduleBase): raddress = list(set(raddress)) if not raddress: - self.logger.warn('%s: no running addresses' + self.logger.warning('%s: no running addresses' %ifaceobjrunning.name) raddress = [] ifaceobjrunning.update_config('address-virtual', diff --git a/ifupdown2/addons/bond.py b/ifupdown2/addons/bond.py index def4922..a4f83aa 100644 --- a/ifupdown2/addons/bond.py +++ b/ifupdown2/addons/bond.py @@ -366,7 +366,7 @@ class bond(Addon, moduleBase): elif (not config_link_down and not link_up): self.netlink.link_up_force(s) except Exception as e: - self.logger.warn('%s: %s' % (ifaceobj.name, str(e))) + self.logger.warning('%s: %s' % (ifaceobj.name, str(e))) def _check_updown_delay_log(self, ifaceobj, attr_name, value): ifaceobj.status = ifaceStatus.ERROR @@ -459,7 +459,7 @@ class bond(Addon, moduleBase): min_links = self.cache.get_link_info_data_attribute(ifname, Link.IFLA_BOND_MIN_LINKS) # get_min_links_nl may return None so we need to strictly check 0 if min_links == 0: - self.logger.warn('%s: attribute bond-min-links is set to \'0\'' % ifname) + self.logger.warning('%s: attribute bond-min-links is set to \'0\'' % ifname) else: # IFLA_BOND_AD_LACP_RATE and IFLA_BOND_AD_LACP_BYPASS only for 802.3ad mode (4) for nl_attr, attr_name in self._bond_lacp_attrs: diff --git a/ifupdown2/addons/bridge.py b/ifupdown2/addons/bridge.py index e3112a2..6aa1b3e 100644 --- a/ifupdown2/addons/bridge.py +++ b/ifupdown2/addons/bridge.py @@ -875,7 +875,7 @@ class bridge(Addon, moduleBase): if (ifaceobj.get_attr_value('bridge-access') and (self.get_ifaceobj_bridge_vids_value(ifaceobj) or ifaceobj.get_attr_value('bridge-pvid'))): - self.logger.warn('%s: bridge-access given, bridge-vids and bridge-pvid ' + self.logger.warning('%s: bridge-access given, bridge-vids and bridge-pvid ' 'will be ignored' % ifaceobj.name) return False return True @@ -1190,7 +1190,7 @@ class bridge(Addon, moduleBase): a = int(part) result.append(a) except: - self.logger.warn('unable to parse vids \'%s\'' + self.logger.warning('unable to parse vids \'%s\'' %''.join(rangelist)) pass return result @@ -1481,7 +1481,7 @@ class bridge(Addon, moduleBase): except exceptions.ReservedVlanException as e: raise e except Exception: - self.logger.warn('%s: unable to parse vid \'%s\'' + self.logger.warning('%s: unable to parse vid \'%s\'' %(ifaceobj.name, v)) return ret @@ -1517,7 +1517,7 @@ class bridge(Addon, moduleBase): try: pvid_int = int(pvid) if pvid else 0 except Exception: - self.logger.warn('%s: unable to parse pvid \'%s\'' + self.logger.warning('%s: unable to parse pvid \'%s\'' %(bportifaceobj.name, pvid)) pvid_int = 0 pass @@ -1720,7 +1720,7 @@ class bridge(Addon, moduleBase): raise e except Exception as e: err = True - self.logger.warn('%s: %s' %(ifaceobj.name, str(e))) + self.logger.warning('%s: %s' %(ifaceobj.name, str(e))) pass self.iproute2.batch_commit() if err: @@ -1731,7 +1731,7 @@ class bridge(Addon, moduleBase): lower_ifaceobj_list = ifaceobj_getfunc(bridgeportifaceobj.lowerifaces[0]) if lower_ifaceobj_list and lower_ifaceobj_list[0] and \ not lower_ifaceobj_list[0].link_privflags & ifaceLinkPrivFlags.BRIDGE_PORT: - self.logger.warn('%s: untagged bridge not found. Please configure a bridge with untagged bridge ports to avoid Spanning Tree Interoperability issue.' % bridgename) + self.logger.warning('%s: untagged bridge not found. Please configure a bridge with untagged bridge ports to avoid Spanning Tree Interoperability issue.' % bridgename) self.warn_on_untagged_bridge_absence = False def bridge_port_get_bridge_name(self, ifaceobj): @@ -3225,7 +3225,7 @@ class bridge(Addon, moduleBase): bridge_name = self.cache.get_bridge_name_from_port(ifname) if not bridge_name: - self.logger.warn("%s: unable to determine bridge name" % ifname) + self.logger.warning("%s: unable to determine bridge name" % ifname) return if self.cache.bridge_is_vlan_aware(bridge_name): @@ -3430,7 +3430,7 @@ class bridge(Addon, moduleBase): bridge_vids = None bridge_pvid = None if not bridgename: - self.logger.warn('%s: unable to find bridgename' + self.logger.warning('%s: unable to find bridgename' %ifaceobjrunning.name) return diff --git a/ifupdown2/addons/bridgevlan.py b/ifupdown2/addons/bridgevlan.py index af4cef9..4ebde30 100644 --- a/ifupdown2/addons/bridgevlan.py +++ b/ifupdown2/addons/bridgevlan.py @@ -78,7 +78,7 @@ class bridgevlan(Addon, moduleBase): raise if not self.cache.link_exists(bridgename): - #self.logger.warn('%s: bridge %s does not exist' %(ifaceobj.name, + #self.logger.warning('%s: bridge %s does not exist' %(ifaceobj.name, # bridgename)) return @@ -106,12 +106,12 @@ class bridgevlan(Addon, moduleBase): (bridgename, vlan) = self._get_bridge_n_vlan(ifaceobj) vlanid = int(vlan, 10) except: - self.logger.warn("%s: bridge vlan interface name does not " + self.logger.warning("%s: bridge vlan interface name does not " "correspond to format (eg. br0.100)" % ifaceobj.name) raise if not self.cache.link_exists(bridgename): - #self.logger.warn('%s: bridge %s does not exist' %(ifaceobj.name, + #self.logger.warning('%s: bridge %s does not exist' %(ifaceobj.name, # bridgename)) return mcqv4src = ifaceobj.get_attr_value_first('bridge-igmp-querier-src') diff --git a/ifupdown2/addons/mstpctl.py b/ifupdown2/addons/mstpctl.py index 694233e..c03a7f8 100644 --- a/ifupdown2/addons/mstpctl.py +++ b/ifupdown2/addons/mstpctl.py @@ -443,7 +443,7 @@ class mstpctl(Addon, moduleBase): self.mstpctlcmd.set_bridge_attr(ifaceobj.name, dstattrname, config_val, check) except Exception as e: - self.logger.warn('%s' %str(e)) + self.logger.warning('%s' %str(e)) pass if self.cache.bridge_is_vlan_aware(ifaceobj.name): @@ -1080,7 +1080,7 @@ class mstpctl(Addon, moduleBase): def _query_running_bridge_port(self, ifaceobjrunning): bridgename = self.cache.get_master(ifaceobjrunning.name) if not bridgename: - self.logger.warn('%s: unable to determine bridgename' + self.logger.warning('%s: unable to determine bridgename' %ifaceobjrunning.name) return if self.sysfs.bridge_get_stp(bridgename) == 'no': diff --git a/ifupdown2/addons/usercmds.py b/ifupdown2/addons/usercmds.py index 209dae7..a7dcec7 100644 --- a/ifupdown2/addons/usercmds.py +++ b/ifupdown2/addons/usercmds.py @@ -52,7 +52,7 @@ class usercmds(moduleBase): utils.exec_user_command(cmd) except Exception as e: if not self.ignore_error(str(e)): - self.logger.warn('%s: %s %s' % (ifaceobj.name, op, + self.logger.warning('%s: %s %s' % (ifaceobj.name, op, str(e).strip('\n'))) pass diff --git a/ifupdown2/addons/vrf.py b/ifupdown2/addons/vrf.py index 0afae9a..7a1bb2e 100644 --- a/ifupdown2/addons/vrf.py +++ b/ifupdown2/addons/vrf.py @@ -118,7 +118,7 @@ class vrf(Addon, moduleBase): self.ip_rule_cache = [b' '.join(r.split()) for r in ip_rules] except Exception as e: self.ip_rule_cache = [] - self.logger.warn('vrf: cache v4: %s' % str(e)) + self.logger.warning('vrf: cache v4: %s' % str(e)) try: ip_rules = utils.exec_command('%s -6 rule show' @@ -126,7 +126,7 @@ class vrf(Addon, moduleBase): self.ip6_rule_cache = [b' '.join(r.split()) for r in ip_rules] except Exception as e: self.ip6_rule_cache = [] - self.logger.warn('vrf: cache v6: %s' % str(e)) + self.logger.warning('vrf: cache v6: %s' % str(e)) #self.logger.debug("vrf: ip rule cache") #self.logger.info(self.ip_rule_cache) @@ -268,7 +268,7 @@ class vrf(Addon, moduleBase): ' pls check if your iproute2 version' + ' supports rt_tables.d') else: - self.logger.warn('unable to open iproute2 vrf to table ' + + self.logger.warning('unable to open iproute2 vrf to table ' + 'map (%s)\n' %errstr) self.warn_on_vrf_map_write_err = False @@ -417,7 +417,7 @@ class vrf(Addon, moduleBase): elif ifaceobj.upperifaces: vrf_master = ifaceobj.upperifaces[0] if not vrf_master: - self.logger.warn('%s: vrf master not found' %ifacename) + self.logger.warning('%s: vrf master not found' %ifacename) return if os.path.exists('/sys/class/net/%s' %vrf_master): self.logger.info('%s: vrf master %s exists returning' @@ -974,7 +974,7 @@ class vrf(Addon, moduleBase): try: self._down_vrf_helper(ifaceobj, vrf_table) except Exception as e: - self.logger.warn('%s: %s' %(ifaceobj.name, str(e))) + self.logger.warning('%s: %s' %(ifaceobj.name, str(e))) pass try: @@ -1009,7 +1009,7 @@ class vrf(Addon, moduleBase): if ifaceobj: self.netlink.link_down(ifacename) except Exception as e: - self.logger.warn('%s: %s' %(ifacename, str(e))) + self.logger.warning('%s: %s' %(ifacename, str(e))) def _down(self, ifaceobj, ifaceobj_getfunc=None): try: diff --git a/ifupdown2/addons/vrrpd.py b/ifupdown2/addons/vrrpd.py index bbf34f1..5b9c5a0 100644 --- a/ifupdown2/addons/vrrpd.py +++ b/ifupdown2/addons/vrrpd.py @@ -92,13 +92,13 @@ class vrrpd(moduleBase): if attrval: cmd += ' -p %s' %attrval else: - self.logger.warn('%s: incomplete vrrp parameters ' %ifaceobj.name, + self.logger.warning('%s: incomplete vrrp parameters ' %ifaceobj.name, '(priority not found)') attrval = ifaceobj.get_attr_value_first('vrrp-virtual-ip') if attrval: cmd += ' %s' %attrval else: - self.logger.warn('%s: incomplete vrrp arguments ' %ifaceobj.name, + self.logger.warning('%s: incomplete vrrp arguments ' %ifaceobj.name, '(virtual ip not found)') return cmd = ('%s -n -D -i %s %s' % diff --git a/ifupdown2/ifupdown/ifupdownmain.py b/ifupdown2/ifupdown/ifupdownmain.py index fc59ee1..1adb97a 100644 --- a/ifupdown2/ifupdown/ifupdownmain.py +++ b/ifupdown2/ifupdown/ifupdownmain.py @@ -207,7 +207,7 @@ class ifupdownMain: if self.logger.getEffectiveLevel() == logging.DEBUG: traceback.print_stack() traceback.print_exc() - self.logger.warn(str) + self.logger.warning(str) pass def log_error(self, str): @@ -686,7 +686,7 @@ class ifupdownMain: dlist = module.get_dependent_ifacenames(ifaceobj, ifacenames) except Exception as e: - self.logger.warn('%s: error getting dependent interfaces (%s)' + self.logger.warning('%s: error getting dependent interfaces (%s)' %(ifaceobj.name, str(e))) dlist = None pass @@ -710,7 +710,7 @@ class ifupdownMain: continue ulist = module.get_upper_ifacenames(ifaceobj, ifacenames) except Exception as e: - self.logger.warn('%s: error getting upper interfaces (%s)' + self.logger.warning('%s: error getting upper interfaces (%s)' %(ifaceobj.name, str(e))) ulist = None pass @@ -829,7 +829,7 @@ class ifupdownMain: self.ifaceobjdict[ifaceobj.name] = [ifaceobj] return if ifaceobj.compare(currentifaceobjlist[0]): - self.logger.warn('duplicate interface %s found' %ifaceobj.name) + self.logger.warning('duplicate interface %s found' %ifaceobj.name) return for obj in self.ifaceobjdict[ifaceobj.name]: if obj.type == ifaceobj.type: @@ -850,7 +850,7 @@ class ifupdownMain: ifaceobj.flags |= ifaceobj.YOUNGEST_SIBLING return if ifaceobj.compare(currentifaceobjlist[0]): - self.logger.warn('duplicate interface %s found' %ifaceobj.name) + self.logger.warning('duplicate interface %s found' %ifaceobj.name) return if currentifaceobjlist[0].type == ifaceobj.type: currentifaceobjlist[0].flags |= ifaceobj.HAS_SIBLINGS @@ -1234,11 +1234,11 @@ class ifupdownMain: validvals, validrange) if not res['result']: - self.logger.warn('%s: %s: %s' % + self.logger.warning('%s: %s: %s' % (ifacename, attrname, res['message'])) success = False except Exception as e: - self.logger.warn('addon \'%s\': %s: %s' % (module_name, + self.logger.warning('addon \'%s\': %s: %s' % (module_name, attrname, str(e))) success = False @@ -1259,7 +1259,7 @@ class ifupdownMain: self.get_ifaceobjs): result = False except Exception as e: - self.logger.warn('%s: %s' % (ifacename, str(e))) + self.logger.warning('%s: %s' % (ifacename, str(e))) result = False return result @@ -1274,9 +1274,9 @@ class ifupdownMain: if a.get('deprecated'): newa = a.get('new-attribute') if newa: - self.logger.warn('attribute %s is deprecated. use %s instead.' %(attrname, newa)) + self.logger.warning('attribute %s is deprecated. use %s instead.' %(attrname, newa)) else: - self.logger.warn('attribute %s is deprecated.' + self.logger.warning('attribute %s is deprecated.' %attrname) return True else: @@ -1298,7 +1298,7 @@ class ifupdownMain: break if not found: ret = False - self.logger.warn('%s: unsupported attribute \'%s\'' \ + self.logger.warning('%s: unsupported attribute \'%s\'' \ % (ifaceobj.name, attrname)) continue return ret @@ -1345,7 +1345,7 @@ class ifupdownMain: mname = litems[1] self.module_ops[operation].append(mname) except Exception as e: - self.logger.warn('error reading line \'%s\' %s:' %(l, str(e))) + self.logger.warning('error reading line \'%s\' %s:' %(l, str(e))) continue def load_addon_modules(self, modules_dir_list): @@ -1658,7 +1658,7 @@ class ifupdownMain: if self.link_exists(i): func(i) except Exception as e: - self.logger.warn(str(e)) + self.logger.warning(str(e)) pass def _get_iface_exclude_companion(self, ifacename): @@ -1794,7 +1794,7 @@ class ifupdownMain: if not filtered_ifacenames: filtered_ifacenames = [] - for ifname, ifaceobj_list in self.ifaceobjdict.iteritems(): + for ifname, ifaceobj_list in self.ifaceobjdict.items(): if not all and ifname not in filtered_ifacenames: continue @@ -2009,7 +2009,7 @@ class ifupdownMain: except: raise if not self.ifaceobjdict: - self.logger.warn("nothing to reload ..exiting.") + self.logger.warning("nothing to reload ..exiting.") return already_up_ifacenames = [] if not ifacenames: ifacenames = list(self.ifaceobjdict.keys()) @@ -2104,7 +2104,7 @@ class ifupdownMain: raise if not self.ifaceobjdict: - self.logger.warn("nothing to reload ..exiting.") + self.logger.warning("nothing to reload ..exiting.") return if not ifacenames: ifacenames = list(self.ifaceobjdict.keys()) @@ -2235,7 +2235,7 @@ class ifupdownMain: ) if print_warning: - self.logger.warn(warning_no_config_regex) + self.logger.warning(warning_no_config_regex) else: # The warning shouldn't be printed because we've detected that this # interface was pick up as part of a regex but the config doesn't @@ -2260,7 +2260,7 @@ class ifupdownMain: elif (lastifaceobjlist[0].link_kind and not newifaceobjlist[0].link_kind): - self.logger.warn('%s: moved from being a %s to a' + self.logger.warning('%s: moved from being a %s to a' ' physical interface (non-logical interface).' 'This interface will be downed.\n' ' If this was not intentional, please restore the' diff --git a/ifupdown2/ifupdown/networkinterfaces.py b/ifupdown2/ifupdown/networkinterfaces.py index 0626393..2d9a1a5 100644 --- a/ifupdown2/ifupdown/networkinterfaces.py +++ b/ifupdown2/ifupdown/networkinterfaces.py @@ -94,9 +94,9 @@ class networkInterfaces(): def _parse_warn(self, filename, lineno, msg): if lineno == -1 or self._currentfile_has_template: - self.logger.warn('%s: %s' %(filename, msg)) + self.logger.warning('%s: %s' %(filename, msg)) else: - self.logger.warn('%s: line%d: %s' %(filename, lineno, msg)) + self.logger.warning('%s: line%d: %s' %(filename, lineno, msg)) self.warns += 1 def _validate_addr_family(self, ifaceobj, lineno=-1): @@ -475,7 +475,7 @@ class networkInterfaces(): with open(filename) as f: filedata = f.read() except Exception as e: - self.logger.warn('error processing file %s (%s)', + self.logger.warning('error processing file %s (%s)', filename, str(e)) return self.read_filedata(filedata) @@ -512,8 +512,8 @@ class networkInterfaces(): parser arguments """ if not self.interfacesfile and not self.interfacesfileiobuf: - self.logger.warn('no terminal line stdin used or ') - self.logger.warn('no network interfaces file defined.') + self.logger.warning('no terminal line stdin used or ') + self.logger.warning('no network interfaces file defined.') self.warns += 1 return diff --git a/ifupdown2/ifupdown/scheduler.py b/ifupdown2/ifupdown/scheduler.py index 59a523e..02a4280 100644 --- a/ifupdown2/ifupdown/scheduler.py +++ b/ifupdown2/ifupdown/scheduler.py @@ -173,7 +173,7 @@ class ifaceScheduler(): handler(ifupdownobj, ifaceobjs[0]) except Exception as e: if not ifupdownobj.link_master_slave_ignore_error(str(e)): - ifupdownobj.logger.warn('%s: %s' + ifupdownobj.logger.warning('%s: %s' %(ifaceobjs[0].name, str(e))) pass for ifaceobj in ifaceobjs: @@ -187,7 +187,7 @@ class ifaceScheduler(): [posthookfunc(ifupdownobj, ifaceobj, ops[0]) for ifaceobj in ifaceobjs] except Exception as e: - ifupdownobj.logger.warn('%s' %str(e)) + ifupdownobj.logger.warning('%s' %str(e)) pass @classmethod @@ -232,7 +232,7 @@ class ifaceScheduler(): ifupdownobj.logger.info('%s: skipping interface down,' %ifaceobj.name + ' upperiface %s still around ' %u) else: - ifupdownobj.logger.warn('%s: skipping interface down,' + ifupdownobj.logger.warning('%s: skipping interface down,' %ifaceobj.name + ' upperiface %s still around ' %u) return False return True @@ -376,7 +376,7 @@ class ifaceScheduler(): except Exception as e: if ifupdownobj.logger.isEnabledFor(logging.DEBUG): traceback.print_tb(sys.exc_info()[2]) - ifupdownobj.logger.warn('%s : %s' %(ifacename, str(e))) + ifupdownobj.logger.warning('%s : %s' %(ifacename, str(e))) pass @classmethod @@ -442,7 +442,7 @@ class ifaceScheduler(): cls.run_iface_list_ops(ifupdownobj, ifaceobjs, ops) except Exception as e: if continueonfailure: - ifupdownobj.logger.warn('%s' %str(e)) + ifupdownobj.logger.warning('%s' %str(e)) @classmethod def _dump_dependency_info(cls, ifupdownobj, ifacenames, @@ -570,7 +570,7 @@ class ifaceScheduler(): ifupdownobj.logger.debug('graph roots (interfaces that ' + 'dont have dependents):' + ' %s' %str(run_queue)) else: - ifupdownobj.logger.warn('interface sort returned None') + ifupdownobj.logger.warning('interface sort returned None') # If queue not present, just run interfaces that were asked by the # user diff --git a/ifupdown2/ifupdown/template.py b/ifupdown2/ifupdown/template.py index bc55b8e..648f6a8 100644 --- a/ifupdown2/ifupdown/template.py +++ b/ifupdown2/ifupdown/template.py @@ -29,7 +29,7 @@ class templateEngine(): try: self.tclass = utils.importName('mako.template', 'Template') except Exception as e: - self.logger.warn('unable to load template engine %s (%s)' + self.logger.warning('unable to load template engine %s (%s)' %(template_engine, str(e))) pass if template_lookuppath: @@ -40,7 +40,7 @@ class templateEngine(): self.tclassargs['lookup'] = lc( directories=template_lookuppath.split(':')) except Exception as e: - self.logger.warn('unable to set template lookup path' + self.logger.warning('unable to set template lookup path' ' %s (%s): are you sure \'python-mako\'' 'is installed?' % (template_lookuppath, str(e))) diff --git a/ifupdown2/ifupdownaddons/modulebase.py b/ifupdown2/ifupdownaddons/modulebase.py index 673f6c6..f32a0da 100644 --- a/ifupdown2/ifupdownaddons/modulebase.py +++ b/ifupdown2/ifupdownaddons/modulebase.py @@ -96,7 +96,7 @@ class moduleBase(object): if self.logger.getEffectiveLevel() == logging.DEBUG: traceback.print_stack() traceback.print_exc() - self.logger.warn(str) + self.logger.warning(str) if ifaceobj: ifaceobj.set_status(ifaceStatus.WARNING) pass @@ -140,7 +140,7 @@ class moduleBase(object): try: proc_ifacenames = self.get_ifaces_from_proc() except: - self.logger.warn('%s: error reading ifaces from proc' %ifacename) + self.logger.warning('%s: error reading ifaces from proc' %ifacename) for proc_ifacename in proc_ifacenames: try: @@ -175,7 +175,7 @@ class moduleBase(object): ' or swp[1-10]sub[0-4].300') if ',' in expr: - self.logger.warn('%s: comma are not supported in glob: %s' % (ifacename, errmsg)) + self.logger.warning('%s: comma are not supported in glob: %s' % (ifacename, errmsg)) yield expr return @@ -222,7 +222,7 @@ class moduleBase(object): else: # Could not match anything. - self.logger.warn('%s: %s' %(ifacename, errmsg)) + self.logger.warning('%s: %s' %(ifacename, errmsg)) yield expr def parse_port_list(self, ifacename, port_expr, ifacenames=None): @@ -281,7 +281,7 @@ class moduleBase(object): with open(filename, 'w') as f: f.write(strexpr) except IOError as e: - self.logger.warn('error writing to file %s' + self.logger.warning('error writing to file %s' %filename + '(' + str(e) + ')') return -1 return 0 diff --git a/ifupdown2/ifupdownaddons/mstpctlutil.py b/ifupdown2/ifupdownaddons/mstpctlutil.py index 06c110d..dc9aaaf 100644 --- a/ifupdown2/ifupdownaddons/mstpctlutil.py +++ b/ifupdown2/ifupdownaddons/mstpctlutil.py @@ -258,7 +258,7 @@ class mstpctlutil(utilsBase): try: self.set_bridge_attr(bridgename, k, v, check) except Exception as e: - self.logger.warn('%s: %s' %(bridgename, str(e))) + self.logger.warning('%s: %s' %(bridgename, str(e))) def get_bridge_treeprio(self, bridgename): return self.get_bridge_attr(bridgename, 'treeprio') diff --git a/ifupdown2/ifupdownaddons/utilsbase.py b/ifupdown2/ifupdownaddons/utilsbase.py index acc2c1a..da38d95 100644 --- a/ifupdown2/ifupdownaddons/utilsbase.py +++ b/ifupdown2/ifupdownaddons/utilsbase.py @@ -46,7 +46,7 @@ class utilsBase(object): with open(filename, 'w') as f: f.write(strexpr) except IOError as e: - self.logger.warn('error writing to file %s' + self.logger.warning('error writing to file %s' %filename + '(' + str(e) + ')') return -1 return 0 diff --git a/ifupdown2/lib/io.py b/ifupdown2/lib/io.py index 2e7bb13..3086ea8 100644 --- a/ifupdown2/lib/io.py +++ b/ifupdown2/lib/io.py @@ -44,7 +44,7 @@ class IO(BaseObject): f.write(string) return True except IOError as e: - self.logger.warn("error while writing to file %s: %s" % (path, str(e))) + self.logger.warning("error while writing to file %s: %s" % (path, str(e))) return False def write_to_file_dry_run(self, path, string): diff --git a/ifupdown2/lib/iproute2.py b/ifupdown2/lib/iproute2.py index 6b92832..545985e 100644 --- a/ifupdown2/lib/iproute2.py +++ b/ifupdown2/lib/iproute2.py @@ -319,7 +319,7 @@ class IPRoute2(Cache, Requirements): if m and m.group(1) != svcnodeip: cur_peers.append(m.group(1)) except: - self.logger.warn('error parsing ip link output') + self.logger.warning('error parsing ip link output') except subprocess.CalledProcessError as e: if e.returncode != 1: self.logger.error(str(e)) @@ -623,16 +623,16 @@ class IPRoute2(Cache, Requirements): self.logger.info("%s: set mcqv4src vlan: invalid parameter %s: %s" % (bridge, vlan, str(e))) return if vlan == 0 or vlan > 4095: - self.logger.warn("mcqv4src vlan '%d' invalid range" % vlan) + self.logger.warning("mcqv4src vlan '%d' invalid range" % vlan) return ip = mcquerier.split(".") if len(ip) != 4: - self.logger.warn("mcqv4src '%s' invalid IPv4 address" % mcquerier) + self.logger.warning("mcqv4src '%s' invalid IPv4 address" % mcquerier) return for k in ip: if not k.isdigit() or int(k, 10) < 0 or int(k, 10) > 255: - self.logger.warn("mcqv4src '%s' invalid IPv4 address" % mcquerier) + self.logger.warning("mcqv4src '%s' invalid IPv4 address" % mcquerier) return utils.exec_command("%s setmcqv4src %s %d %s" % (utils.brctl_cmd, bridge, vlan, mcquerier)) -- 2.39.2