mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 20:31:27 -07:00
replace type() with isinstance() (#3404)
Replace use of type() with isinstance() Addresses https://github.com/ansible/ansible/issues/18310
This commit is contained in:
parent
81286b8912
commit
6cfb44b4bb
7 changed files with 22 additions and 22 deletions
|
@ -430,7 +430,7 @@ def core(module):
|
|||
|
||||
if state and command=='list_vms':
|
||||
res = v.list_vms(state=state)
|
||||
if type(res) != dict:
|
||||
if not isinstance(res, dict):
|
||||
res = { command: res }
|
||||
return VIRT_SUCCESS, res
|
||||
|
||||
|
@ -477,13 +477,13 @@ def core(module):
|
|||
res = {'changed': True, 'created': guest}
|
||||
return VIRT_SUCCESS, res
|
||||
res = getattr(v, command)(guest)
|
||||
if type(res) != dict:
|
||||
if not isinstance(res, dict):
|
||||
res = { command: res }
|
||||
return VIRT_SUCCESS, res
|
||||
|
||||
elif hasattr(v, command):
|
||||
res = getattr(v, command)()
|
||||
if type(res) != dict:
|
||||
if not isinstance(res, dict):
|
||||
res = { command: res }
|
||||
return VIRT_SUCCESS, res
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue