Skip to content

Commit

Permalink
Merge pull request #299 from slemrmartin/ic-builder-infra
Browse files Browse the repository at this point in the history
Persister: InventoryCollection building through add_collection() (Infra)
  • Loading branch information
agrare committed Jul 20, 2018
2 parents c7ce240 + 3d7d704 commit 021bed2
Show file tree
Hide file tree
Showing 4 changed files with 318 additions and 348 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,76 +1,11 @@
class ManageIQ::Providers::Vmware::InfraManager::Inventory::Persister < ManagerRefresh::Inventory::Persister
def initialize_inventory_collections
add_inventory_collections(
default_inventory_collections, inventory_collection_names, inventory_collection_options
)

relationship_collections = %i(ems_clusters ems_folders hosts resource_pools storages)
dependency_attributes = relationship_collections.each_with_object({}) do |collection_key, obj|
obj[collection_key] = [collections[collection_key]]
end

add_inventory_collection(
default_inventory_collections.parent_blue_folders(:dependency_attributes => dependency_attributes)
)

add_inventory_collection(
default_inventory_collections.vm_parent_blue_folders(
:dependency_attributes => {:vms_and_templates => [collections[:vms_and_templates]]},
)
)
require_nested :Batch
require_nested :Targeted

add_inventory_collection(
default_inventory_collections.vm_resource_pools(
:dependency_attributes => {:vms_and_templates => [collections[:vms_and_templates]]},
)
)
include ::ManageIQ::Providers::Vmware::Inventory::Persister::Definitions::InfraCollections

add_inventory_collection(
default_inventory_collections.root_folder_relationship(
:dependency_attributes => {:ems_folders => [collections[:ems_folders]]},
)
)

add_inventory_collection(
default_inventory_collections.snapshot_parent(
:dependency_attributes => {:snapshots => [collections[:snapshots]]},
)
)
end

def default_inventory_collections
ManageIQ::Providers::Vmware::InfraManager::Inventory::InventoryCollections
end

def inventory_collection_names
%i(
custom_attributes
customization_specs
disks
ems_clusters
ems_folders
guest_devices
hardwares
hosts
host_guest_devices
host_hardwares
host_networks
host_storages
host_switches
host_system_services
host_operating_systems
lans
miq_scsi_luns
miq_scsi_targets
networks
operating_systems
resource_pools
snapshots
storages
storage_profiles
switches
vms_and_templates
)
def initialize_inventory_collections
initialize_infra_inventory_collections
end

def complete
Expand All @@ -85,16 +20,21 @@ def strategy
nil
end

def targeted
def targeted?
false
end

def inventory_collection_options
def parent
manager.presence
end

def shared_options
{
:complete => complete,
:saver_strategy => saver_strategy,
:strategy => strategy,
:targeted => targeted,
:targeted => targeted?,
:parent => parent
}
end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class ManageIQ::Providers::Vmware::InfraManager::Inventory::Persister::Targeted < ManageIQ::Providers::Vmware::InfraManager::Inventory::Persister
def targeted
def targeted?
true
end

Expand Down
Loading

0 comments on commit 021bed2

Please sign in to comment.