-
Notifications
You must be signed in to change notification settings - Fork 897
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
Fix MiqRequestTask ResourceAction with a Workflow #23123
Fix MiqRequestTask ResourceAction with a Workflow #23123
Conversation
app/models/miq_request_task.rb
Outdated
@@ -140,12 140,13 @@ def deliver_queue(req_type = request_type, zone = nil) | |||
|
|||
_log.info("Queuing #{request_class::TASK_DESCRIPTION}: [#{description}]...") | |||
|
|||
workflow = ConfigurationScriptPayload.find(options[:configuration_script_payload_id]) if options[:configuration_script_payload_id] | |||
workflow_id = resource_action&.configuration_script_id || options[:configuration_script_payload_id] |
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 is a little complicated and I need to do some investigation to see if we can clean this up.
Basically if a Generic ServiceTemplate is created with an Embedded Workflow for an Entry Point that is set in the resource_action.
If a e.g. VMware ServiceTemplate is created the workflow goes to options[:configuration_script_payload_id]
also when the child tasks are created.
68efbb4
to
b9c3dd3
Compare
app/models/miq_request_task.rb
Outdated
options[:configuration_script_payload_id] = workflow.id | ||
options[:configuration_script_payload_id] = workflow_id |
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.
I think leave this as it was
Is there a way to test that it executes this properly? |
If a ServiceTemplate has a ResourceAction with a configuration_script_payload as its entrypoint this was not being run by MiqRequestTask#deliver_queue.
dc524e8
to
15a393e
Compare
15a393e
to
9b75538
Compare
9b75538
to
c69f814
Compare
3ca43d5
to
aa5b237
Compare
Checked commits agrare/manageiq@b489fe3~...aa5b237 with ruby 3.1.5, rubocop 1.56.3, haml-lint 0.51.0, and yamllint |
Backported to
|
…ction_workflow Fix MiqRequestTask ResourceAction with a Workflow (cherry picked from commit 4b49d30)
If a ServiceTemplate has a ResourceAction with a
configuration_script_payload as its entrypoint this was not being run by MiqRequestTask#deliver_queue.
Introduced by #23039
We did have a spec test covering this case but it was changed by https://github.com/ManageIQ/manageiq/pull/23039/files#diff-169a716c426d776976d164d5088f0f2dc18360c2417272e40af19f153e86f437 so the regression wasn't caught.
Service Templates
Pure workflows based service catalog item
VMware provision with workflows built-in
Ordering
Pure Workflows
You get a single MiqRequestTask that is a
ServiceTemplateProvisionTask
This was where we had the original https://github.com/ManageIQ/manageiq/pull/22511/files#diff-8dfa5b51b60d86d6591a7daba20e32a847ffd140f057a52b251dccb5b82984faR142-R143 code to execute this.
deliver_queue here is called by:
VMware MiqProvision with Workflows
With this you get 3 MiqRequestTasks, 2
ServiceTemplateProvisionTask
and 1ManageIQ::Providers::Vmware::InfraManager::Provision
/MiqProvision
task.Top level service template provision task:
"intermediate" service tempalate provision task:
And finally the MiqProvision task:
The problem
The issue here is that for a pure-workflows
ServiceTemplateProvisionTask
we have the workflow id in the resource_action, and we want to execute it for thatServiceTemplateProvisionTask
However, with a VMware based provision using a workflow we also have a
ServiceTemplateProvisionTask
that has a resource_action with the workflow id, BUT we don't want to execute that with workflows we only want to execute theMiqProvision
task with workflows.I tried moving the workflow definition down to
MiqProvision
to check options and leaving theServiceTemplateProvisionTask
to check the resource_action, but the issue is both have a valid resource_action workflow_id and we only want to call workflows on ONE of these types.I think if we could get the pure-workflow
ServiceTemplateProvisionTask
to have the configuration_script_payload_id in options to indicate that we want to execute the workflow on this miq_request_task that would work.