mirror of
https://github.com/ansible-collections/google.cloud.git
synced 2025-04-10 21:00:28 -07:00
Merge pull request #677 from p3ck/issues-651
Some checks failed
Run integration tests for the cloud.google collection / integration (stable-2.16) (push) Has been cancelled
Run integration tests for the cloud.google collection / integration (stable-2.17) (push) Has been cancelled
Run integration tests for the cloud.google collection / integration (stable-2.18) (push) Has been cancelled
Some checks failed
Run integration tests for the cloud.google collection / integration (stable-2.16) (push) Has been cancelled
Run integration tests for the cloud.google collection / integration (stable-2.17) (push) Has been cancelled
Run integration tests for the cloud.google collection / integration (stable-2.18) (push) Has been cancelled
Fix get_project_disks to process all responses
This commit is contained in:
commit
6fa0c8718f
1 changed files with 30 additions and 30 deletions
|
@ -487,38 +487,38 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
|
||||||
session_responses.append(response_json)
|
session_responses.append(response_json)
|
||||||
page_token = "pageToken" in request_params
|
page_token = "pageToken" in request_params
|
||||||
|
|
||||||
for response in session_responses:
|
for response in session_responses:
|
||||||
if "items" in response:
|
if "items" in response:
|
||||||
# example k would be a zone or region name
|
# example k would be a zone or region name
|
||||||
# example v would be { "disks" : [], "otherkey" : "..." }
|
# example v would be { "disks" : [], "otherkey" : "..." }
|
||||||
for zone_or_region, aggregate in response["items"].items():
|
for zone_or_region, aggregate in response["items"].items():
|
||||||
if "zones" in zone_or_region:
|
if "zones" in zone_or_region:
|
||||||
if "disks" in aggregate:
|
if "disks" in aggregate:
|
||||||
zone = zone_or_region.replace("zones/", "")
|
zone = zone_or_region.replace("zones/", "")
|
||||||
for disk in aggregate["disks"]:
|
for disk in aggregate["disks"]:
|
||||||
if (
|
if (
|
||||||
"zones" in config_data
|
"zones" in config_data
|
||||||
and zone in config_data["zones"]
|
and zone in config_data["zones"]
|
||||||
):
|
):
|
||||||
# If zones specified, only store those zones' data
|
# If zones specified, only store those zones' data
|
||||||
if "sourceImage" in disk:
|
if "sourceImage" in disk:
|
||||||
self._project_disks[
|
self._project_disks[
|
||||||
disk["selfLink"]
|
disk["selfLink"]
|
||||||
] = disk["sourceImage"].split("/")[-1]
|
] = disk["sourceImage"].split("/")[-1]
|
||||||
else:
|
else:
|
||||||
self._project_disks[
|
self._project_disks[
|
||||||
disk["selfLink"]
|
disk["selfLink"]
|
||||||
] = disk["selfLink"].split("/")[-1]
|
] = disk["selfLink"].split("/")[-1]
|
||||||
|
|
||||||
else:
|
|
||||||
if "sourceImage" in disk:
|
|
||||||
self._project_disks[
|
|
||||||
disk["selfLink"]
|
|
||||||
] = disk["sourceImage"].split("/")[-1]
|
|
||||||
else:
|
else:
|
||||||
self._project_disks[
|
if "sourceImage" in disk:
|
||||||
disk["selfLink"]
|
self._project_disks[
|
||||||
] = disk["selfLink"].split("/")[-1]
|
disk["selfLink"]
|
||||||
|
] = disk["sourceImage"].split("/")[-1]
|
||||||
|
else:
|
||||||
|
self._project_disks[
|
||||||
|
disk["selfLink"]
|
||||||
|
] = disk["selfLink"].split("/")[-1]
|
||||||
|
|
||||||
return self._project_disks
|
return self._project_disks
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue