mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
cloudstack: handle unicode API results in has_changed (#16601)
* cloudstack: handle unicode API results in has_changed * cloudstack: add more case sensitve keys
This commit is contained in:
parent
58eab8ee9f
commit
0f5f5fffee
1 changed files with 13 additions and 5 deletions
|
@ -93,6 +93,9 @@ class AnsibleCloudStack(object):
|
|||
# these keys will be compared case sensitive in self.has_changed()
|
||||
self.case_sensitive_keys = [
|
||||
'id',
|
||||
'displaytext',
|
||||
'displayname',
|
||||
'description',
|
||||
]
|
||||
|
||||
self.module = module
|
||||
|
@ -155,11 +158,16 @@ class AnsibleCloudStack(object):
|
|||
continue
|
||||
|
||||
if key in current_dict:
|
||||
if self.case_sensitive_keys and key in self.case_sensitive_keys:
|
||||
if str(value) != str(current_dict[key]):
|
||||
if isinstance(current_dict[key], (int, long, float, complex)):
|
||||
if value != current_dict[key]:
|
||||
return True
|
||||
else:
|
||||
if self.case_sensitive_keys and key in self.case_sensitive_keys:
|
||||
if value != current_dict[key].encode('utf-8'):
|
||||
return True
|
||||
|
||||
# Test for diff in case insensitive way
|
||||
elif str(value).lower() != str(current_dict[key]).lower():
|
||||
elif value.lower() != current_dict[key].encode('utf-8').lower():
|
||||
return True
|
||||
else:
|
||||
return True
|
||||
|
|
Loading…
Reference in a new issue