Skip to content

Commit

Permalink
feature 33 (internal) main_v4.1 disable UserScript wrapper (#1609)
Browse files Browse the repository at this point in the history
  • Loading branch information
georgemccabe authored May 11, 2022
1 parent 916c862 commit 75106f9
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
21 changes: 19 additions & 2 deletions docs/Users_Guide/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ External Components

.. _external-components-gfdl-tracker:

GFDL Tracker
------------
GFDL Tracker (optional)
-----------------------

- The standalone Geophysical Fluid Dynamics Laboratory (GFDL) vortex tracker
is a program that objectively analyzes forecast data to provide an
Expand All @@ -278,6 +278,23 @@ GFDL Tracker
- Instructions on how to configure and use the GFDL tracker are found here
https://dtcenter.org/sites/default/files/community-code/gfdl/standalone_tracker_UG_v3.9a.pdf

Disable UserScript wrapper (optional)
=====================================

The UserScript wrapper allows any shell command or script to be run as part
of a METplus use case. It is used to preprocess/postprocess data or to run
intermediate commands between other wrappers.

**If desired, this wrapper can be disabled upon installation to prevent
security risks.** To disable the UserScript wrapper,
simply remove the following file from the installation location::

METplus/metplus/wrapper/user_script_wrapper.py

Please note that use cases provided with the METplus repository that utilize
the UserScript wrapper will fail if attempted to run after it has been
disabled.

Add ush directory to shell path (optional)
==========================================

Expand Down
2 changes: 2 additions & 0 deletions docs/Users_Guide/wrappers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8894,6 +8894,8 @@ referenced inside the user-defined script to obtain a list of the files that
should be processed.
See :term:`USER_SCRIPT_INPUT_TEMPLATE` for more information.

Note: This wrapper may be disabled upon installation to prevent security risks.

METplus Configuration
---------------------

Expand Down
9 changes: 7 additions & 2 deletions metplus/util/met_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,13 @@ def run_metplus(config, process_list):
command_builder.run_all_times()
return 0
except AttributeError:
raise NameError("There was a problem loading "
f"{process} wrapper.")
logger.error("There was a problem loading "
f"{process} wrapper.")
return 1
except ModuleNotFoundError:
logger.error(f"Could not load {process} wrapper. "
"Wrapper may have been disabled.")
return 1

processes.append(command_builder)

Expand Down

0 comments on commit 75106f9

Please sign in to comment.