Skip to content

Commit

Permalink
Return false if the comparsison is not equal
Browse files Browse the repository at this point in the history
Add credentials to tests

pep8
  • Loading branch information
s-hertel committed Sep 5, 2018
1 parent f069aed commit bab7f3f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 2 additions & 4 deletions lib/ansible/modules/cloud/amazon/ec2_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,9 @@ def rule_cmp(a, b):
for prop in ['port_range', 'protocol', 'target', 'target_type']:
if prop == 'port_range' and to_text(a.protocol) == to_text(b.protocol):
# equal protocols can interchange `(-1, -1)` and `(None, None)`
if (
a.port_range in ((None, None), (-1, -1))
and b.port_range in ((None, None), (-1, -1))):
if a.port_range in ((None, None), (-1, -1)) and b.port_range in ((None, None), (-1, -1)):
continue
else:
elif getattr(a, prop) != getattr(b, prop):
return False
elif getattr(a, prop) != getattr(b, prop):
return False
Expand Down
4 changes: 3 additions & 1 deletion test/integration/targets/ec2_group/tasks/numeric_protos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,15 @@
description: '{{ ec2_group_description }}'
tags:
foo: 1
- name: Readd a tag with a numeric value
<<: *aws_connection_info
- name: Read a tag with a numeric value
ec2_group:
name: '{{ group_tmp_name }}'
vpc_id: '{{ vpc_result.vpc.id }}'
description: '{{ ec2_group_description }}'
tags:
foo: 1
<<: *aws_connection_info
register: result
- assert:
that:
Expand Down

0 comments on commit bab7f3f

Please sign in to comment.