Skip to content

Commit

Permalink
Code quality fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
fboender committed Feb 24, 2019
1 parent 66adf24 commit e0c53eb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/runscript.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
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."""
Expand All @@ -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 ' \
Expand Down
3 changes: 2 additions & 1 deletion src/scriptform.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -246,5 +246,6 @@ def main(): # pragma: no cover
log.exception(err)
raise


if __name__ == "__main__": # pragma: no cover
main()
3 changes: 2 additions & 1 deletion src/webapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@
{footer}
'''


def censor_form_values(form_def, form_values):
"""
Remove sensitive field values from form_values dict.
Expand Down Expand Up @@ -433,7 +434,7 @@ def h_submit(self, form_values):
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,
Expand Down

0 comments on commit e0c53eb

Please sign in to comment.