mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
ifupdown: add new ifupdownflags class to carry ifupdown flags
Ticket: cleanup Reviewed By: Testing Done: Tested ifupdown sanity This gets rid of some ugly previous flag handling which was passed through modules. This creates a global instance of flags that all addon modules and helper modules can use. Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
This commit is contained in:
@ -9,6 +9,7 @@
|
||||
from ifupdown.iface import *
|
||||
from ifupdownaddons.modulebase import moduleBase
|
||||
from ifupdownaddons.iproute2 import iproute2
|
||||
import ifupdown.ifupdownflags as ifupdownflags
|
||||
import logging
|
||||
|
||||
class link(moduleBase):
|
||||
@ -32,7 +33,8 @@ class link(moduleBase):
|
||||
ifaceobj.get_attr_value_first('link-type'))
|
||||
|
||||
def _down(self, ifaceobj):
|
||||
if not self.PERFMODE and not self.ipcmd.link_exists(ifaceobj.name):
|
||||
if (not ifupdownflags.flags.PERFMODE and
|
||||
not self.ipcmd.link_exists(ifaceobj.name)):
|
||||
return
|
||||
try:
|
||||
self.ipcmd.link_delete(ifaceobj.name)
|
||||
@ -60,7 +62,7 @@ class link(moduleBase):
|
||||
|
||||
def _init_command_handlers(self):
|
||||
if not self.ipcmd:
|
||||
self.ipcmd = iproute2(**self.get_flags())
|
||||
self.ipcmd = iproute2()
|
||||
|
||||
def run(self, ifaceobj, operation, query_ifaceobj=None, **extra_args):
|
||||
op_handler = self._run_ops.get(operation)
|
||||
|
Reference in New Issue
Block a user