diff --git a/ifupdown2/ifupdown/argv.py b/ifupdown2/ifupdown/argv.py index 4e1da40..e560b40 100644 --- a/ifupdown2/ifupdown/argv.py +++ b/ifupdown2/ifupdown/argv.py @@ -148,6 +148,13 @@ class Parse: help='type of interface entry (iface or vlan). ' 'This option can be used in case of ambiguity between ' 'a vlan interface and an iface interface of the same name') + argparser.add_argument( + "--nldebug", + dest="nldebug", + action="store_true", + default=False, + help="print netlink debug messages" + ) def update_ifupdown_argparser(self, argparser): """ common arg parser for ifup and ifdown """ diff --git a/ifupdown2/ifupdown/ifupdownmain.py b/ifupdown2/ifupdown/ifupdownmain.py index b6afe58..01163e2 100644 --- a/ifupdown2/ifupdown/ifupdownmain.py +++ b/ifupdown2/ifupdown/ifupdownmain.py @@ -219,7 +219,7 @@ class ifupdownMain: def link_exists(self, ifacename): return os.path.exists('/sys/class/net/%s' %ifacename) - def __init__(self, config={}, + def __init__(self, config={}, args=None, daemon=False, force=False, dryrun=False, nowait=False, perfmode=False, withdepends=False, njobs=1, cache=False, addons_enable=True, statemanager_enable=True, @@ -247,7 +247,7 @@ class ifupdownMain: self.reset_ifupdown2() else: # init nlcache with appropriate log level - nlcache.NetlinkListenerWithCache.init(logging.root.level) + nlcache.NetlinkListenerWithCache.init(logging.DEBUG if args.nldebug else logging.WARNING) # start netlink listener and cache link/addr/netconf dumps nlcache.NetlinkListenerWithCache.get_instance().start() diff --git a/ifupdown2/ifupdown/main.py b/ifupdown2/ifupdown/main.py index 7847ba1..f33a0f0 100644 --- a/ifupdown2/ifupdown/main.py +++ b/ifupdown2/ifupdown/main.py @@ -159,7 +159,7 @@ class Ifupdown2: log.debug('creating ifupdown object ..') cachearg = (False if (iflist or args.nocache or args.noact) else True) - ifupdown_handle = ifupdownMain(daemon=self.daemon, + ifupdown_handle = ifupdownMain(daemon=self.daemon, args=args, config=configmap_g, force=args.force, withdepends=args.withdepends, @@ -193,7 +193,7 @@ class Ifupdown2: try: iflist = args.iflist log.debug('creating ifupdown object ..') - ifupdown_handle = ifupdownMain(daemon=self.daemon, + ifupdown_handle = ifupdownMain(daemon=self.daemon, args=args, config=configmap_g, force=args.force, withdepends=args.withdepends, perfmode=args.perfmode, @@ -239,7 +239,7 @@ class Ifupdown2: iflist = [i for i in os.listdir('/sys/class/net/') if os.path.isdir('/sys/class/net/%s' % i)] log.debug('creating ifupdown object ..') - ifupdown_handle = ifupdownMain(daemon=self.daemon, + ifupdown_handle = ifupdownMain(daemon=self.daemon, args=args, config=configmap_g, withdepends=args.withdepends, perfmode=args.perfmode, @@ -263,7 +263,7 @@ class Ifupdown2: try: log.debug('creating ifupdown object ..') - ifupdown_handle = ifupdownMain(daemon=self.daemon, + ifupdown_handle = ifupdownMain(daemon=self.daemon, args=args, config=configmap_g, interfacesfile=self.interfaces_filename, withdepends=args.withdepends,