Code quality fixes.

pull/7/head 1.4
Ferry Boender 6 years ago
parent 66adf2473b
commit e0c53eb9ad
  1. 5
      src/runscript.py
  2. 3
      src/scriptform.py
  3. 3
      src/webapp.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 ' \

@ -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()

@ -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,

Loading…
Cancel
Save