Skip to content

Commit

Permalink
Merge pull request #259 from agrare/set_ems_api_version_and_uid_ems
Browse files Browse the repository at this point in the history
Set api_version and uid_ems in streaming refresh
  • Loading branch information
Ladas authored May 14, 2018
2 parents 6f9bb61 + 90ff1d3 commit e2e2b80
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ 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 Down Expand Up @@ -108,6 +112,13 @@ 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 @@ -23,7 +23,7 @@
run_full_refresh
ems.reload

assert_table_counts
assert_ems
assert_specific_datacenter
assert_specific_folder
assert_specific_host
Expand All @@ -50,7 +50,7 @@

it "doesn't impact unassociated inventory" do
run_targeted_refresh(targeted_update_set([vm_power_on_object_update]))
assert_table_counts
assert_ems
end

it "power on a virtual machine" do
Expand Down Expand Up @@ -164,7 +164,9 @@ def run_full_refresh
end
end

def assert_table_counts
def assert_ems
expect(ems.api_version).to eq("5.5")
expect(ems.uid_ems).to eq("D6EB1D64-05B2-4937-BFF6-6F77C6E647B7")
expect(ems.ems_clusters.count).to eq(8)
expect(ems.ems_folders.count).to eq(21)
expect(ems.ems_folders.where(:type => "Datacenter").count).to eq(4)
Expand Down

0 comments on commit e2e2b80

Please sign in to comment.