diff --git a/lib/galaxy/tool_util/parser/output_actions.py b/lib/galaxy/tool_util/parser/output_actions.py
index dd04cfdb766..e190d50d43f 100644
--- a/lib/galaxy/tool_util/parser/output_actions.py
+++ b/lib/galaxy/tool_util/parser/output_actions.py
@@ -7,6 +7,7 @@ import os.path
import re
from galaxy import util
+from galaxy.util.template import fill_template
log = logging.getLogger(__name__)
@@ -81,7 +82,7 @@ class ValueToolOutputActionConditionalWhen(ToolOutputActionConditionalWhen):
def is_case(self, output_dataset, other_values):
ref = self.get_ref(output_dataset, other_values)
- return bool(str(ref) == self.value)
+ return ref == self.value
class DatatypeIsInstanceToolOutputActionConditionalWhen(ToolOutputActionConditionalWhen):
@@ -304,8 +305,17 @@ class MetadataToolOutputAction(ToolOutputAction):
def apply_action(self, output_dataset, other_values):
value = self.option.get_value(other_values)
- if value is None and self.default is not None:
- value = self.default
+ # TODO: figure out correct type based on MetadataElementSpec,
+ # but MetadataElementSpec doesn't actually define a type (but it should).
+ # That would avoid the ad-hoc comma splitting here for defaults.
+ if self.default:
+ # For historical reasons the default value takes preference over value,
+ # and we only treat the default value as potentially containing cheetah.
+ value = fill_template(
+ self.default,
+ context=other_values,
+ python_template_version=other_values.get("__python_template_version__"),
+ ).split(",")
if value is not None:
setattr(output_dataset.metadata, self.name, value)
diff --git a/lib/galaxy/tools/actions/__init__.py b/lib/galaxy/tools/actions/__init__.py
index aa9f97e500a..8927e06f74d 100644
--- a/lib/galaxy/tools/actions/__init__.py
+++ b/lib/galaxy/tools/actions/__init__.py
@@ -538,12 +538,9 @@ class DefaultToolAction(ToolAction):
if output.actions:
# Apply pre-job tool-output-dataset actions; e.g. setting metadata, changing format
output_action_params = dict(out_data)
- output_action_params.update(incoming)
+ output_action_params.update(wrapped_params.params)
+ output_action_params["__python_template_version__"] = tool.python_template_version
output.actions.apply_action(data, output_action_params)
- # Also set the default values of actions of type metadata
- self.set_metadata_defaults(
- output, data, tool, on_text, trans, incoming, history, wrapped_params.params, job_params
- )
# Flush all datasets at once.
return data
@@ -913,26 +910,6 @@ class DefaultToolAction(ToolAction):
job_params=job_params,
)
- def set_metadata_defaults(self, output, dataset, tool, on_text, trans, incoming, history, params, job_params):
- """
- This allows to map names of input files to metadata default values. Example:
-
- .. code-block::
-
-
-
-
-
-
- """
- if output.actions:
- for action in output.actions.actions:
- if action.tag == "metadata" and action.default:
- metadata_new_value = fill_template(
- action.default, context=params, python_template_version=tool.python_template_version
- ).split(",")
- dataset.metadata.__setattr__(str(action.name), metadata_new_value)
-
def _get_default_data_name(
self, dataset, tool, on_text=None, trans=None, incoming=None, history=None, params=None, job_params=None, **kwd
):
diff --git a/test/functional/tools/identifier_in_actions.xml b/test/functional/tools/identifier_in_actions.xml
index ecccf112a47..a7aba432006 100644
--- a/test/functional/tools/identifier_in_actions.xml
+++ b/test/functional/tools/identifier_in_actions.xml
@@ -4,6 +4,7 @@
]]>
+
@@ -11,6 +12,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -18,6 +31,9 @@
+