-
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
Missing required data in copied ServiceTemplate #18949
Comments
Per the original issue (#18450) I don't believe this should've extended to tags or resource actions. |
@d-m-u |
I was explicitly told to not copy resource actions, but if the UI team thinks that the things that were not included in the original are integral to functionality, please feel free to take over this issue. |
Description updated. @miq-bot assign @ZitaNemeckova |
I would suggest something like this (except this doesn't work :) ) def template_copy(new_name = "Copy of " + name + Time.zone.now.to_s)
if template_valid? && type != 'ServiceTemplateAnsiblePlaybook'
ActiveRecord::Base.transaction do
dup.tap do |template|
template.update_attributes(:name => new_name, :display => false)
++ template.resource_actions.build(:fqname => resource_actions.first.fqname)
service_resources.each { |service_resource| resource_copy(service_resource, template) }
direct_custom_buttons.each { |custom_button| custom_button_copy(custom_button, template) }
custom_button_sets.each { |custom_button_set| custom_button_set_copy(custom_button_set, template) }
end.save!
end
end
end |
@ZitaNemeckova PR #18973 adds the resource_actions and picture to the copy method. (additional_tenants are derived from the Automate entry-points defined by the resource_actions.) Display is intentionally set to Finally, the copy of Thanks for pointing out these omissions. |
When I call following methods on copied
ServiceTemplate
I getnil
/false
or empty array instead of the value that original has.display
additional_tenant_ids
resource_actions
picture
#18450tags
Related to ManageIQ/manageiq-ui-classic#5667
EDIT:
resource_actions
is needed to get Provision Entry Point that's required for all types of Catalog Item and Catalog Bundle. Everything else is optional and not needed at this point.@miq-bot assign @d-m-u
cc @gmcculloug @tinaafitz
The text was updated successfully, but these errors were encountered: