diff --git a/apps/dashboard/app/models/project.rb b/apps/dashboard/app/models/project.rb index bfa6b561f..a0571e033 100644 --- a/apps/dashboard/app/models/project.rb +++ b/apps/dashboard/app/models/project.rb @@ -263,12 +263,12 @@ def sync_template # that point to the _new_ project directory, not the template's directory. # This creates them _and_ serializes them to yml in the new directory. def save_new_launchers - dir = Launcher.scripts_dir(template) - Dir.glob("#{dir}/*/form.yml").map do |script_yml| - Launcher.from_yaml(script_yml, project_dataroot) - end.map do |script| - saved_successfully = script.save - errors.add(:save, script.errors.full_messages) unless saved_successfully + dir = Launcher.launchers_dir(template) + Dir.glob("#{dir}/*/form.yml").map do |launcher_yml| + Launcher.from_yaml(launcher_yml, project_dataroot) + end.map do |launcher| + saved_successfully = launcher.save + errors.add(:save, launcher.errors.full_messages) unless saved_successfully saved_successfully end.all? do |saved_successfully| diff --git a/apps/dashboard/test/models/projects_test.rb b/apps/dashboard/test/models/projects_test.rb index a124f5c96..1e0162053 100644 --- a/apps/dashboard/test/models/projects_test.rb +++ b/apps/dashboard/test/models/projects_test.rb @@ -127,14 +127,14 @@ class ProjectsTest < ActiveSupport::TestCase template_dir = File.join(tmp,'template') job_log_path = "#{template_dir}/.ondemand/job_log.yml" launcher_id = '50r4nd0m' - cache_json_path = "#{template_dir}/.ondemand/scripts/#{launcher_id}/cache.json" + cache_json_path = "#{template_dir}/.ondemand/launchers/#{launcher_id}/cache.json" file_content = <<~HEREDOC some multiline content echo 'multiline content' description: multiline content HEREDOC - Pathname.new("#{template_dir}/.ondemand/scripts/#{launcher_id}").mkpath + Pathname.new("#{template_dir}/.ondemand/launchers/#{launcher_id}").mkpath File.open(job_log_path, 'w') { |file| file.write(file_content) } File.open(cache_json_path, 'w') { |file| file.write(file_content) }