Skip to content
This repository has been archived by the owner on Apr 7, 2022. It is now read-only.

Commit

Permalink
Merge pull request #8226 from digitronik/fix_cluster_datastore
Browse files Browse the repository at this point in the history
[RFR] fix all method
  • Loading branch information
mshriver committed Dec 4, 2018
2 parents 71a2db4 + d8a8e2e commit 6dec86b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cfme/infrastructure/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def all(self):
providers_db = {
prov.id: get_crud_by_name(prov.name)
for prov in providers
if not (getattr(prov, "parent_ems_id", False) and ("Manager" in prov.name))
if not (getattr(prov, "parent_ems_id", False) or ("Manager" in prov.name))
}
cluster_obj = [
self.instantiate(name=cluster.name, provider=providers_db[cluster.ems_id])
Expand Down
11 changes: 9 additions & 2 deletions cfme/infrastructure/datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,18 @@ def all(self):
datastores = self.appliance.rest_api.collections.data_stores.all_include_attributes(
attributes=["hosts"]
)
datastore_db = {ds.name: ds.hosts[0]["ems_id"] for ds in datastores if ds.hosts}
datastore_db = {}

for ds in datastores:
for host in ds.hosts:
if host.get("ems_id"):
datastore_db.update({ds.name: host.get("ems_id")})
break

provider_db = {
prov.id: get_crud_by_name(prov.name)
for prov in self.appliance.rest_api.collections.providers.all
if not (getattr(prov, "parent_ems_id", False) and ("Manager" in prov.name))
if not (getattr(prov, "parent_ems_id", False) or ("Manager" in prov.name))
}
datastores = [
self.instantiate(name=name, provider=provider_db[prov_id])
Expand Down

0 comments on commit 6dec86b

Please sign in to comment.