-
Notifications
You must be signed in to change notification settings - Fork 898
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
Create a provision request for a service template #13972
Conversation
fe55d2b
to
16d0f25
Compare
app/models/service_template.rb
Outdated
workflow = ResourceActionWorkflow.new({}, User.find_by!(:userid => userid), | ||
provision_action, :target => self) | ||
options.each { |key, value| workflow.set_value(key, value) } | ||
workflow.submit_request |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mkanoor If we want to allow the API to call this it should be broken up into two methods. One to be called from the API that returns the workflow to match what the current code does: lib/services/api/service_template_workflow.rb#L7
And another which can be called when we need to create and submit the workflow. This would support the two use cases from the API as well as what we need for control actions and automate.
Current API callers:
workflow = ServiceTemplateWorkflow.create(service_template, data || {}) |
ServiceTemplateWorkflow.create(service_template, service_request) |
LGTM @abellotti Please review the recent changes. |
app/models/service_template.rb
Outdated
def provision_workflow(userid, options = {}) | ||
ResourceActionWorkflow.new({}, User.find_by!(:userid => userid), | ||
provision_action, :target => self).tap do |wf| | ||
options.each { |key, value| wf.set_value(key, value) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this might fail if method is called as provision_workflow(userid, nil)
maybe default options to nil, then have a separate options ||= {}
@abellotti @gmcculloug |
LGTM!! @mkanoor thanks for the update. |
3d5e38e
to
2757fc9
Compare
Fails with the |
ab1abab
to
06fdddd
Compare
Checked commits mkanoor/manageiq@b4cf882~...06fdddd with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
@gmcculloug |
👍 Once we tests green. |
Model method to submit a provision request from a service template.
https://www.pivotaltracker.com/n/projects/1937537/stories/140055813
This method is also accessible from Automate method e.g