diff --git a/app/models/manageiq/providers/workflows/automation_manager/configuration_script_source.rb b/app/models/manageiq/providers/workflows/automation_manager/configuration_script_source.rb index 095882a..42ee7ac 100644 --- a/app/models/manageiq/providers/workflows/automation_manager/configuration_script_source.rb +++ b/app/models/manageiq/providers/workflows/automation_manager/configuration_script_source.rb @@ -76,22 +76,24 @@ def sync_from_content(to_delete) end def create_workflow_from_payload(name, payload) - payload_valid, payload_error = + floe_workflow, payload_error = begin Floe::Workflow.new(payload) - true rescue Floe::InvalidWorkflowError => err - [false, err.message] + [nil, err.message] end + description = floe_workflow&.comment + configuration_script_payloads.find_or_initialize_by(:name => name).tap do |wf| wf.update!( :name => name, + :description => description, :manager_id => manager_id, :type => self.class.module_parent::Workflow.name, :payload => payload, :payload_type => "json", - :payload_valid => payload_valid, + :payload_valid => !!floe_workflow, :payload_error => payload_error ) end diff --git a/spec/models/manageiq/providers/workflows/automation_manager/configuration_script_source_spec.rb b/spec/models/manageiq/providers/workflows/automation_manager/configuration_script_source_spec.rb index 393b92a..4eced75 100644 --- a/spec/models/manageiq/providers/workflows/automation_manager/configuration_script_source_spec.rb +++ b/spec/models/manageiq/providers/workflows/automation_manager/configuration_script_source_spec.rb @@ -195,6 +195,7 @@ def files_in_repository(git_repo_dir) expect(record.configuration_script_payloads.first).to have_attributes( :name => "hello_world.asl", + :description => "hello world", :payload => a_string_including("\"Comment\": \"hello world\""), :payload_type => "json", :payload_valid => true,