Unverified Commit f16be61b authored by John Chilton's avatar John Chilton Committed by GitHub
Browse files

Merge pull request #16219 from mvdbeek/fix_tool_util_dependency_on_cheetah

[23.0] Don't fail CWL tool parsing when Cheetah not installed
parents a5ab850a ad5b8394
Loading
Loading
Loading
Loading
+16 −6
Original line number Diff line number Diff line
@@ -7,7 +7,11 @@ import os.path
import re

from galaxy import util

try:
    from galaxy.util.template import fill_template
except ImportError:
    fill_template = None  # type: ignore[assignment]

log = logging.getLogger(__name__)

@@ -311,11 +315,17 @@ class MetadataToolOutputAction(ToolOutputAction):
        if self.default:
            # For historical reasons the default value takes preference over value,
            # and we only treat the default value as potentially containing cheetah.
            if fill_template is not None:
                value = fill_template(
                    self.default,
                    context=other_values,
                    python_template_version=other_values.get("__python_template_version__"),
                ).split(",")
            else:
                # fallback when Cheetah not available, equivalent to how this was handled prior 23.0
                # definitely not needed for CWL tool parsing
                log.warning("Cheetah not installed, falling back to legacy 'apply_action' behavior.")
                value = self.default
        if value is not None:
            setattr(output_dataset.metadata, self.name, value)