]> git.proxmox.com Git - mirror_ifupdown2.git/commitdiff
python3: logging: the 'warn' method is deprecated, use warning instead
authorJulien Fortin <julien@cumulusnetworks.com>
Mon, 9 Dec 2019 21:31:46 +0000 (22:31 +0100)
committerJulien Fortin <julien@cumulusnetworks.com>
Tue, 17 Dec 2019 16:19:05 +0000 (17:19 +0100)
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
18 files changed:
ifupdown2/addons/address.py
ifupdown2/addons/addressvirtual.py
ifupdown2/addons/bond.py
ifupdown2/addons/bridge.py
ifupdown2/addons/bridgevlan.py
ifupdown2/addons/mstpctl.py
ifupdown2/addons/usercmds.py
ifupdown2/addons/vrf.py
ifupdown2/addons/vrrpd.py
ifupdown2/ifupdown/ifupdownmain.py
ifupdown2/ifupdown/networkinterfaces.py
ifupdown2/ifupdown/scheduler.py
ifupdown2/ifupdown/template.py
ifupdown2/ifupdownaddons/modulebase.py
ifupdown2/ifupdownaddons/mstpctlutil.py
ifupdown2/ifupdownaddons/utilsbase.py
ifupdown2/lib/io.py
ifupdown2/lib/iproute2.py

index a2df24d44ae83ede49ed398545304ad473590f2e..7b172ba165acc113aa73451260b53399540a801d 100644 (file)
@@ -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
index 97e6563218c320aaaa6f0c290f4bdec107bae232..f996e48cf4d1989ee2bcf02c37769a98686676ac 100644 (file)
@@ -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',
index def4922784b80d6e7d9933ed556018adc6901ac3..a4f83aa7eb5347ee920f2fc15f85be835aea01b3 100644 (file)
@@ -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:
index e3112a27ef265b1f73aa49edfc48fca09daf4f3b..6aa1b3e9b6abd4dc57cbac47446876f35db4e777 100644 (file)
@@ -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
 
index af4cef9bae4bd049e716fb04aa5658b2d1a8ee95..4ebde309205088d32562a9b78e40d95e276ed93e 100644 (file)
@@ -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')
index 694233e01fb71b361a07b9b240104ce7f1939114..c03a7f87af6555fb9070694592ff7ef8f35745f3 100644 (file)
@@ -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':
index 209dae7dfcd11a47c63012325231f50cb0116576..a7dcec7dd6e1fb50129d3110083d34061f728cde 100644 (file)
@@ -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
 
index 0afae9a8ad78ac70c58de09b237facc8c1935ef7..7a1bb2ea05204b799fde25b97c2281a64909268b 100644 (file)
@@ -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:
index bbf34f1568f5022e42640434fdfed0bc321391b4..5b9c5a02194fbe760461fc839780a288cecf2543 100644 (file)
@@ -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' %
index fc59ee19578c14701ea07e01b186514de82770eb..1adb97ac9a8c913bcb945bc28cd401a1cd186556 100644 (file)
@@ -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'
index 062639379698b08885bf2893e193301efed082e0..2d9a1a5f569d77fde32356d9ed3824ea29ca6041 100644 (file)
@@ -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
 
index 59a523e14197186939ef9adfea3968c06d5fe832..02a4280b39bfaa4f675d7433dd91ea62dfbdd5fe 100644 (file)
@@ -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
index bc55b8e2359ddaa4a454756be73a4ccf29b98810..648f6a884fb21b3a856e304bcb19d76760daf321 100644 (file)
@@ -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)))
index 673f6c6f92de9a6c3a287d3a9523b470a0bcec04..f32a0dafd1ab0a7ac727eb2677afdc2db44b1dd4 100644 (file)
@@ -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
index 06c110d487d3596e5c4f9ff5efa541a3042e89ff..dc9aaaf7106476153e940e73c231bb5134c1a127 100644 (file)
@@ -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')
index acc2c1a75beb4fa0d57318b69c6a22a46b0ef162..da38d95c99fd9f0a2d4a4abbaa85e8c9fbc6b683 100644 (file)
@@ -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
index 2e7bb13baad24ac29d3c7d2e3975bc034b2f81a3..3086ea83df5a4d3f60c9592487575f2461abbc61 100644 (file)
@@ -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):
index 6b928325b846a9e6e38f57eb7fcf4ef2336bd442..545985ebd715e23aee2e0ed7bce75f3ca8c66692 100644 (file)
@@ -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))