mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07:00
FTD configuration module: fix a bug with response parsing (#57480)
* Update dependence's name to firepower-kickstart * Check response type before getting attributes * Add unit test for construct_ansible_facts method * Update error message
This commit is contained in:
parent
039eb892ba
commit
4fa93d5b9b
5 changed files with 80 additions and 7 deletions
|
@ -65,7 +65,7 @@ def construct_ansible_facts(response, params):
|
|||
response_body = response['items'] if 'items' in response else response
|
||||
if params.get('register_as'):
|
||||
facts[params['register_as']] = response_body
|
||||
elif response_body.get('name') and response_body.get('type'):
|
||||
elif type(response_body) is dict and response_body.get('name') and response_body.get('type'):
|
||||
object_name = re.sub(INVALID_IDENTIFIER_SYMBOLS, '_', response_body['name'].lower())
|
||||
fact_name = '%s_%s' % (response_body['type'], object_name)
|
||||
facts[fact_name] = response_body
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue