mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
Vultr: Ensure facts works when no resource exists (#43603)
Vultr API is being inconsisten in what it returns. An empty list when no resources exists, but a dict of dict when they do. The case needs to be handled so the module do not fail. An extra test has been added.
This commit is contained in:
parent
130824c3e1
commit
68e6587748
6 changed files with 18 additions and 0 deletions
|
@ -103,6 +103,9 @@ class AnsibleVultrFirewallGroupFacts(Vultr):
|
|||
|
||||
|
||||
def parse_fw_group_list(fwgroups_list):
|
||||
if not fwgroups_list:
|
||||
return []
|
||||
|
||||
return [group for id, group in fwgroups_list.items()]
|
||||
|
||||
|
||||
|
|
|
@ -98,6 +98,9 @@ class AnsibleVultrSSHKeyFacts(Vultr):
|
|||
|
||||
|
||||
def parse_keys_list(keys_list):
|
||||
if not keys_list:
|
||||
return []
|
||||
|
||||
return [key for id, key in keys_list.items()]
|
||||
|
||||
|
||||
|
|
|
@ -102,6 +102,9 @@ class AnsibleVultrStartupScriptFacts(Vultr):
|
|||
|
||||
|
||||
def parse_startupscript_list(startupscipts_list):
|
||||
if not startupscipts_list:
|
||||
return []
|
||||
|
||||
return [startupscript for id, startupscript in startupscipts_list.items()]
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue