mirror of https://github.com/ansible/ansible.git
module_utils/vultr.py: Ensure comparison is accurate (#43298)
In query_resource_by_key(), there is an equal comparison that is made to know if the object we are looking for is present. Due to type difference this comparison doesn't always retrieve true, even when it should. This is due to the fact that the value in r_data dict are of type unicode, while the other can be of type int, float,... . ``` >>> a = u'1' >>> type(a) <type 'unicode'> >>> b = 1 >>> type(b) <type 'int'> >>> a == b False >>> str(a) == str(b) True ``` Hence the values, for comparison purposes, are casted into strings.pull/41222/merge
parent
051320a5f5
commit
ffcdc53536
Loading…
Reference in New Issue