]> code.ossystems Code Review - openembedded-core.git/commitdiff
scriptutils: pass in logger as parameter
authorChang Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com>
Wed, 28 Jun 2017 01:59:18 +0000 (09:59 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 21 Jul 2017 11:36:36 +0000 (12:36 +0100)
logger was not defined in scriptutils.py based on the
observation in python traceback.

Traceback (most recent call last):
  File "/workdir/poky/scripts/devtool", line 351, in <module>
    ret = main()
  File "/workdir/poky/scripts/devtool", line 338, in main
    ret = args.func(args, config, basepath, workspace)
  File "/workdir/poky/scripts/lib/devtool/utilcmds.py", line 55, in
edit_recipe
    return scriptutils.run_editor(find_recipe(args, config, basepath,
workspace))
  File "/workdir/poky/scripts/lib/scriptutils.py", line 141, in
run_editor
    logger.error("Execution of '%s' failed: %s" % (editor, exc))
NameError: name 'logger' is not defined

We pass in logger as parameter to run_editor() from where it has
been called (devtool/utilcmds.py and recipetool/newappend.py),
which both modules already has logger setup.

Signed-off-by: Chang Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
scripts/lib/devtool/utilcmds.py
scripts/lib/recipetool/newappend.py
scripts/lib/scriptutils.py

index 0437e6417cc1f5edd750808293ca173b7cac0023..938d88afc0c7dcbb9abbcbfeedd23860d6212d2f 100644 (file)
@@ -49,7 +49,7 @@ def edit_recipe(args, config, basepath, workspace):
             raise DevtoolError("Recipe file for %s is not under the workspace" %
                                args.recipename)
 
-    return scriptutils.run_editor(recipefile)
+    return scriptutils.run_editor(recipefile, logger)
 
 
 def configure_help(args, config, basepath, workspace):
index 0b63759d8c5be4b54f4904714656a34c0f83b694..decce83facd7e811368958d664707c8a05fe2d14 100644 (file)
@@ -74,7 +74,7 @@ def newappend(args):
             return 1
 
     if args.edit:
-        return scriptutils.run_editor([append_path, recipe_path])
+        return scriptutils.run_editor([append_path, recipe_path], logger)
     else:
         print(append_path)
 
index b6217dc059957e87ef318c0af4b854f7f29f9621..97854385d519025b4f1ddf6923f6f2a0d629811f 100644 (file)
@@ -205,7 +205,7 @@ def fetch_url(tinfoil, srcuri, srcrev, destdir, logger, preserve_tmp=False):
     return checksums, tmpdir
 
 
-def run_editor(fn):
+def run_editor(fn, logger=None):
     if isinstance(fn, str):
         params = '"%s"' % fn
     else: