From cf6a9fc619a6c65d2bccb563c61b8a448334213c Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Tue, 6 Dec 2016 17:17:49 -0500 Subject: [PATCH] 10674: Initialize defaults when creating container request from workflow. --- .../app/controllers/work_units_controller.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/apps/workbench/app/controllers/work_units_controller.rb b/apps/workbench/app/controllers/work_units_controller.rb index 3b611aa25b..550bdb7e95 100644 --- a/apps/workbench/app/controllers/work_units_controller.rb +++ b/apps/workbench/app/controllers/work_units_controller.rb @@ -57,7 +57,7 @@ class WorkUnitsController < ApplicationController workflow = Workflow.find? template_uuid if workflow.definition begin - wf_json = YAML::load(workflow.definition) + wf_json = ActiveSupport::HashWithIndifferentAccess.new YAML::load(workflow.definition) rescue => e logger.error "Error converting definition yaml to json: #{e.message}" raise ArgumentError, "Error converting definition yaml to json: #{e.message}" @@ -77,11 +77,21 @@ class WorkUnitsController < ApplicationController attrs['cwd'] = "/var/spool/cwl" attrs['output_path'] = "/var/spool/cwl" + input_defaults = {} + if wf_json + inputs = get_cwl_inputs(wf_json) + inputs.each do |input| + if input[:default] + input_defaults[cwl_shortname(input[:id])] = input[:default] + end + end + end + # mounts mounts = { "/var/lib/cwl/cwl.input.json" => { "kind" => "json", - "content" => {} + "content" => input_defaults }, "stdout" => { "kind" => "file", -- 2.30.2