Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set workflow description from asl comment #76

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,24 @@ def sync_from_content(to_delete)
end

def create_workflow_from_payload(name, payload)
floe_workflow =
begin
Floe::Workflow.new(payload)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had this depend on #59 because we were already loading the Floe::Workflow there

rescue Floe::InvalidWorkflowError
nil
end

description = floe_workflow&.comment
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay


configuration_script_payloads.find_or_initialize_by(:name => name).tap do |wf|
wf.update!(:name => name, :manager_id => manager_id, :type => self.class.module_parent::Workflow.name, :payload => payload, :payload_type => "json")
wf.update!(
:name => name,
:description => description,
:manager_id => manager_id,
:type => self.class.module_parent::Workflow.name,
:payload => payload,
:payload_type => "json"
)
end
end
end
2 changes: 1 addition & 1 deletion manageiq-providers-workflows.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_dependency "floe", "~> 0.9.0"
spec.add_dependency "floe", "~> 0.10.0"

spec.add_development_dependency "manageiq-style"
spec.add_development_dependency "simplecov", ">= 0.21.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
2 changes: 1 addition & 1 deletion spec/support/fake_workflows_repo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def file_content(full_path)

def dummy_workflow_data_for(_filename)
<<~WORKFLOW_DATA
{"Comment": "hello world"}
{"Comment": "hello world", "States": {"Start": {"Type": "Succeed"}}, "StartAt": "Start"}
WORKFLOW_DATA
end
end
Expand Down