mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
addons: usercmd: ifquery lists user commands and sets unknown status
Ticket: CM-12724 Reviewed By: Roopa, Nikhil G, Daniel W Testing Done: $ ifquery br0 auto br0 iface br0 bridge-ports tap17 tap19 up ls -l $ ifquery br0 -c auto br0 iface br0 [pass] up ls -l [] bridge-ports tap17 tap19 [pass] Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
This commit is contained in:
@@ -50,12 +50,24 @@ class usercmds(ifupdownaddons.modulebase.moduleBase):
|
||||
str(e).strip('\n')))
|
||||
pass
|
||||
|
||||
def _query_check(self, ifaceobj, ifaceobjcurr):
|
||||
if ifaceobj.config:
|
||||
for ops in ['pre-up',
|
||||
'up',
|
||||
'post-up',
|
||||
'pre-down',
|
||||
'down',
|
||||
'post-down']:
|
||||
for cmd in ifaceobj.config.get(ops, []):
|
||||
ifaceobjcurr.update_config_with_status(ops, cmd, -1)
|
||||
|
||||
_run_ops = {'pre-up' : _run_command,
|
||||
'pre-down' : _run_command,
|
||||
'up' : _run_command,
|
||||
'post-up' : _run_command,
|
||||
'down' : _run_command,
|
||||
'post-down' : _run_command}
|
||||
'post-down' : _run_command,
|
||||
'query-checkcurr': _query_check}
|
||||
|
||||
def get_ops(self):
|
||||
""" returns list of ops supported by this module """
|
||||
@@ -80,4 +92,7 @@ class usercmds(ifupdownaddons.modulebase.moduleBase):
|
||||
op_handler = self._run_ops.get(operation)
|
||||
if not op_handler:
|
||||
return
|
||||
op_handler(self, ifaceobj, operation)
|
||||
if operation == 'query-checkcurr':
|
||||
op_handler(self, ifaceobj, query_ifaceobj)
|
||||
else:
|
||||
op_handler(self, ifaceobj, operation)
|
||||
|
Reference in New Issue
Block a user