mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Use isinstance() instead of type() (#7501)
* Replace type comparisons with isinstance() checks. * Add changelog.
This commit is contained in:
parent
0304989392
commit
48e860be20
4 changed files with 5 additions and 3 deletions
2
changelogs/fragments/7501-type.yml
Normal file
2
changelogs/fragments/7501-type.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- "ocapi_utils, oci_utils, redfish_utils module utils - replace ``type()`` calls with ``isinstance()`` calls (https://github.com/ansible-collections/community.general/pull/7501)."
|
|
@ -432,7 +432,7 @@ class OcapiUtils(object):
|
||||||
else:
|
else:
|
||||||
return response
|
return response
|
||||||
details = response["data"]["Status"].get("Details")
|
details = response["data"]["Status"].get("Details")
|
||||||
if type(details) is str:
|
if isinstance(details, str):
|
||||||
details = [details]
|
details = [details]
|
||||||
health_list = response["data"]["Status"]["Health"]
|
health_list = response["data"]["Status"]["Health"]
|
||||||
return_value = {
|
return_value = {
|
||||||
|
|
|
@ -1529,7 +1529,7 @@ def delete_and_wait(
|
||||||
result[resource_type] = resource
|
result[resource_type] = resource
|
||||||
return result
|
return result
|
||||||
# oci.wait_until() returns an instance of oci.util.Sentinel in case the resource is not found.
|
# oci.wait_until() returns an instance of oci.util.Sentinel in case the resource is not found.
|
||||||
if type(wait_response) is not Sentinel:
|
if not isinstance(wait_response, Sentinel):
|
||||||
resource = to_dict(wait_response.data)
|
resource = to_dict(wait_response.data)
|
||||||
else:
|
else:
|
||||||
resource["lifecycle_state"] = "DELETED"
|
resource["lifecycle_state"] = "DELETED"
|
||||||
|
|
|
@ -3708,7 +3708,7 @@ class RedfishUtils(object):
|
||||||
# WORKAROUND
|
# WORKAROUND
|
||||||
# HPE systems with iLO 4 will have BIOS Attribute Registries location URI as a dictionary with key 'extref'
|
# HPE systems with iLO 4 will have BIOS Attribute Registries location URI as a dictionary with key 'extref'
|
||||||
# Hence adding condition to fetch the Uri
|
# Hence adding condition to fetch the Uri
|
||||||
if type(loc['Uri']) is dict and "extref" in loc['Uri'].keys():
|
if isinstance(loc['Uri'], dict) and "extref" in loc['Uri'].keys():
|
||||||
rsp_uri = loc['Uri']['extref']
|
rsp_uri = loc['Uri']['extref']
|
||||||
if not rsp_uri:
|
if not rsp_uri:
|
||||||
msg = "Language 'en' not found in BIOS Attribute Registries location, URI: %s, response: %s"
|
msg = "Language 'en' not found in BIOS Attribute Registries location, URI: %s, response: %s"
|
||||||
|
|
Loading…
Reference in a new issue