diff --git a/src/runscript.py b/src/runscript.py index c75e083..144b86a 100644 --- a/src/runscript.py +++ b/src/runscript.py @@ -10,9 +10,6 @@ import grp import subprocess -log = logging.getLogger('RUNSCRIPT') - - def run_as(uid, gid, groups): """Closure that changes the current running user and groups. Called before executing scripts by Subprocess.""" @@ -33,6 +30,8 @@ def run_script(form_def, form_values, stdout=None, stderr=None): callback should be written. The output of the script is hooked up to the output, depending on the output type. """ + log = logging.getLogger('RUNSCRIPT') + # Validate params if form_def.output == 'raw' and (stdout is None or stderr is None): msg = 'stdout and stderr cannot be none if script output ' \ diff --git a/src/scriptform.py b/src/scriptform.py index 39ad486..6346c4e 100755 --- a/src/scriptform.py +++ b/src/scriptform.py @@ -216,7 +216,7 @@ def main(): # pragma: no cover # If a form configuration was specified, change to that dir so we can # find the job scripts and such. - if len(args) > 0: + if args: path = os.path.dirname(args[0]) if path: os.chdir(path) @@ -246,5 +246,6 @@ def main(): # pragma: no cover log.exception(err) raise + if __name__ == "__main__": # pragma: no cover main() diff --git a/src/webapp.py b/src/webapp.py index 8da00a4..aa4b21a 100644 --- a/src/webapp.py +++ b/src/webapp.py @@ -159,6 +159,7 @@ HTML_SUBMIT_RESPONSE = u''' {footer} ''' + def censor_form_values(form_def, form_values): """ Remove sensitive field values from form_values dict. @@ -433,7 +434,7 @@ class ScriptFormWebApp(RequestHandler): log.info("Calling script: %s", form_def.script) log.info("Current working dir: %s", cwd) log.info("User: %s", username) - log.info("Variables: %s", censor_form_values(form_def, form_values)) + log.info("Vars: %s", censor_form_values(form_def, form_values)) form_def = form_config.get_form_def(form_name) result = runscript.run_script(form_def, form_values, self.wfile,