-
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
Include resource_actions and picture in service_template copy #18973
Include resource_actions and picture in service_template copy #18973
Conversation
@tinaafitz I did not make the change here but I'm thinking with the change to Ansible runner we can remove the restriction on |
cab68d0
to
eb40d1b
Compare
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.
Tested with UI PR. LGTM 👍
Thanks for fixing it :)
app/models/service_template/copy.rb
Outdated
@@ -7,6 +7,9 @@ def template_copy(new_name = "Copy of " + name + Time.zone.now.to_s) | |||
dup.tap do |template| | |||
template.update_attributes(:name => new_name, :display => false) | |||
service_resources.each { |service_resource| resource_copy(service_resource, template) } | |||
resource_actions.each { |resource_action| resource_action_copy(resource_action, template) } | |||
picture_copy(template) if picture.present? |
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.
Is the .present?
necessary? picture
should be a Picture instance or nil
, right?
] | ||
|
||
new_template = @st1.template_copy | ||
expect(new_template.resource_actions.collect(&:action)).to eq(%w[Provision Retire]) |
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.
Would expect(new_template.resource_actions.pluck(:action)).to match_array(%w[Provision Retire])
be faster and more reliable?
The cleanup of JobTemplate with Ansible runner is not going to happen at the moment. cc @carbonin |
@lfu I said that it's not likely that I will get to cleaning up the job template logic. If someone else wants to take it on, that's fine with me. |
eb40d1b
to
6afcdac
Compare
6afcdac
to
7e176fa
Compare
Checked commits gmcculloug/manageiq@4c3f832~...7e176fa with ruby 2.4.6, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0 spec/models/service_template/copy_spec.rb
|
Added missing associations to the service_template
#template_copy
method and marked existing helper methods as private.Recommend reviewing commit-by-commit.
save!
method so the newly create template is returned from the call, instead oftrue
from thesave!
call and makes helper methods private.Fixes #18949
Closes #18450
Links
Found while working on UI changes ManageIQ/manageiq-ui-classic#5667
Extends work from #18464
Steps for Testing/QA
After copying a service_template validate that it contains the same Automate entry-points, picture and additional_tenants on the summary screen as the original service_template.
cc @d-m-u