get_plug_vars to support mod_name
Added support for mod_name parm to get_plug_vars function. This allows other
modules to use this function to get the main program's plug-in variable values.
Change-Id: Ibe6866655ad6603156b6938855eab46f84f7badb
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/lib/gen_plug_in_utils.py b/lib/gen_plug_in_utils.py
index fa08866..c99d70d 100755
--- a/lib/gen_plug_in_utils.py
+++ b/lib/gen_plug_in_utils.py
@@ -189,7 +189,7 @@
qprint_plug_vars(headers=0, general=False, custom=True)
-def get_plug_vars():
+def get_plug_vars(mod_name="__main__"):
r"""
Get all plug-in variables and put them in corresponding global variables.
@@ -201,9 +201,13 @@
PLUG_VAR_PREFIX value prefix. For example, if the environment variable in
question is AUTOBOOT_OPENBMC_HOST, this function will set global variable
AUTOBOOT_OPENBMC_HOST and global variable OPENBMC_HOST.
+
+ Description of argument(s):
+ mod_name The name of the module whose global
+ plug-in variables should be retrieved.
"""
- module = sys.modules['__main__']
+ module = sys.modules[mod_name]
plug_var_dict = return_plug_vars()
# Get all PLUG_VAR_PREFIX environment variables and put them into globals.