Skip to content

Commit

Permalink
Merge pull request #376 from agrare/set_api_version_with_inv_collection
Browse files Browse the repository at this point in the history
Set EMS attributes with an inventory_collection
  • Loading branch information
Fryguy authored Mar 1, 2019
2 parents 7697933 + 85d40f3 commit 2e2fad0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ def initial_refresh(vim, property_filter)
persister = full_persister_klass.new(ems)
parser = parser_klass.new(inventory_cache, persister)

# Set the ems.api_version and ems.uid_ems manually until there is a way to
# set it with an inventory_collection
set_ems_attributes(vim)

monitor_updates(vim, property_filter, "", persister, parser)
end

Expand All @@ -77,6 +73,7 @@ def monitor_updates(vim, property_filter, version, persister, parser)
updated_objects.concat(process_update_set(property_filter, update_set))
end while update_set.truncated

parser.parse_ext_management_system(ems, vim.serviceContent.about)
parse_updates(updated_objects, parser)
save_inventory(persister)

Expand Down Expand Up @@ -117,13 +114,6 @@ def disconnect(vim)
vim.close
end

def set_ems_attributes(vim)
api_version = vim.serviceContent.about.apiVersion
instance_uuid = vim.serviceContent.about.instanceUuid

ems.update_attributes(:api_version => api_version, :uid_ems => instance_uuid)
end

def wait_for_updates(vim, version)
# Return if we don't receive any updates for 60 seconds break
# so that we can check if we are supposed to exit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ def parse(object, kind, props)
send(parse_method, object, kind, props)
end

def parse_ext_management_system(object, about)
api_version = about.apiVersion
instance_uuid = about.instanceUuid

persister.ext_management_system.build(
:guid => object.guid,
:api_version => api_version,
:uid_ems => instance_uuid,
)
end

def parse_compute_resource(object, kind, props)
persister.ems_clusters.targeted_scope << object._ref
return if kind == "leave"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ def initialize_infra_inventory_collections
add_vms_and_templates

%i(customization_specs
ext_management_system
host_hardwares
host_guest_devices
host_networks
Expand Down

0 comments on commit 2e2fad0

Please sign in to comment.