Os port fix (#24913)

* replace deprecated cmp() with custom conditional
cmp is not present in Python3 but several modules use it
Reference 24756
This commit is contained in:
kgottholm 2017-05-23 12:40:56 -04:00 committed by Toshio Kuratomi
parent 841baa3d5b
commit 1e4b227e6f
3 changed files with 3 additions and 4 deletions

View file

@ -235,7 +235,7 @@ def setup_creation(client, module):
if endpoint['VpcId'] == vpc_id and endpoint['ServiceName'] == service_name:
sorted_endpoint_rt_ids = sorted(endpoint['RouteTableIds'])
sorted_route_table_ids = sorted(route_table_ids)
if cmp(sorted_endpoint_rt_ids, sorted_route_table_ids) == 0:
if sorted_endpoint_rt_ids == sorted_route_table_ids:
return False, camel_dict_to_snake_dict(endpoint)
changed, result = create_vpc_endpoint(client, module)

View file

@ -233,8 +233,7 @@ def _needs_update(module, port, cloud):
if module.params[key] is not None and module.params[key] != port[key]:
return True
for key in compare_dict:
if module.params[key] is not None and cmp(module.params[key],
port[key]) != 0:
if module.params[key] is not None and module.params[key] != port[key]:
return True
for key in compare_list:
if module.params[key] is not None and (set(module.params[key]) !=

View file

@ -223,7 +223,7 @@ class VMwareCluster(object):
self.cluster.configurationEx.drsConfig.enabled,
self.cluster.configurationEx.vsanConfigInfo.enabled)
if cmp(desired_state, current_state) != 0:
if desired_state != current_state:
return 'update'
else:
return 'present'