mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
addons: usercmds: adding environment variables passed by the ifupdown2 to user scripts
Ticket: None Reviewed By: Roopa Testing Done: with a dummy script I printed the value passed by ifupdown After the changes I did the same with ifupdown2 and checksd if the values matched correctly. This issue was reported on the github repository. Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
# Author: Roopa Prabhu, roopa@cumulusnetworks.com
|
||||
#
|
||||
|
||||
import os
|
||||
import ifupdownaddons
|
||||
|
||||
from ifupdown.utils import utils
|
||||
@ -36,6 +37,10 @@ class usercmds(ifupdownaddons.modulebase.moduleBase):
|
||||
def _run_command(self, ifaceobj, op):
|
||||
cmd_list = ifaceobj.get_attr_value(op)
|
||||
if cmd_list:
|
||||
os.environ['IFACE'] = ifaceobj.name
|
||||
os.environ['LOGICAL'] = ifaceobj.name
|
||||
os.environ['METHOD'] = ifaceobj.addr_method
|
||||
os.environ['ADDRFAM'] = ifaceobj.addr_family
|
||||
for cmd in cmd_list:
|
||||
try:
|
||||
utils.exec_user_command(cmd)
|
||||
|
Reference in New Issue
Block a user