diff --git a/lib/generators/provider/templates/app/models/manageiq/providers/%provider_name%/inventory/persister.rb b/lib/generators/provider/templates/app/models/manageiq/providers/%provider_name%/inventory/persister.rb new file mode 100644 index 00000000000..177322fcbdb --- /dev/null +++ b/lib/generators/provider/templates/app/models/manageiq/providers/%provider_name%/inventory/persister.rb @@ -0,0 +1,19 @@ +class ManageIQ::Providers::<%= class_name %>::Inventory::Persister < ManagerRefresh::Inventory::Persister + require_nested :CloudManager + + def strategy + nil + end + + def parent + manager.presence + end + + def shared_options + { + :strategy => strategy, + :targeted => targeted?, + :parent => parent + } + end +end diff --git a/lib/generators/provider/templates/app/models/manageiq/providers/%provider_name%/inventory/persister/cloud_manager.rb b/lib/generators/provider/templates/app/models/manageiq/providers/%provider_name%/inventory/persister/cloud_manager.rb index 9080e055bfb..eaf90fc82ae 100644 --- a/lib/generators/provider/templates/app/models/manageiq/providers/%provider_name%/inventory/persister/cloud_manager.rb +++ b/lib/generators/provider/templates/app/models/manageiq/providers/%provider_name%/inventory/persister/cloud_manager.rb @@ -1,5 +1,7 @@ -class ManageIQ::Providers::<%= class_name %>::Inventory::Persister::CloudManager < ManagerRefresh::Inventory::Persister - include ManagerRefresh::Inventory::CloudManager +class ManageIQ::Providers::<%= class_name %>::Inventory::Persister::CloudManager < ManageIQ::Providers::<%= class_name %>::Inventory::Persister + include ManageIQ::Providers::<%= class_name %>::Inventory::Persister::Definitions::CloudCollections - has_cloud_manager_vms + def initialize_inventory_collections + initialize_cloud_inventory_collections + end end diff --git a/lib/generators/provider/templates/app/models/manageiq/providers/%provider_name%/inventory/persister/definitions/cloud_collections.rb b/lib/generators/provider/templates/app/models/manageiq/providers/%provider_name%/inventory/persister/definitions/cloud_collections.rb new file mode 100644 index 00000000000..bc7fa277cec --- /dev/null +++ b/lib/generators/provider/templates/app/models/manageiq/providers/%provider_name%/inventory/persister/definitions/cloud_collections.rb @@ -0,0 +1,9 @@ +module ManageIQ::Providers::<%= class_name %>::Inventory::Persister::Definitions::CloudCollections + extend ActiveSupport::Concern + + def initialize_cloud_inventory_collections + %i(vms).each do |name| + add_collection(cloud, name) + end + end +end