Skip to content

Instantly share code, notes, and snippets.

@markuman
Created November 22, 2019 10:47
Show Gist options
  • Save markuman/38121d35fb4ea759dc3a6d71d16a6021 to your computer and use it in GitHub Desktop.
Save markuman/38121d35fb4ea759dc3a6d71d16a6021 to your computer and use it in GitHub Desktop.
-- module_utils/aws/elbv2.py 2019-11-22 11:47:07.809636272 +0100
+++ /tmp/elbv2.py.2.9.1 2019-11-22 10:26:21.923061699 +0100
@@ -713,7 +713,8 @@
for current_condition in current_conditions:
if current_condition.get('SourceIpConfig'):
- if current_condition['Field'] == condition['Field'] and current_condition['SourceIpConfig']['Values'][0] == condition['SourceIpConfig']['Values'][0]:
+ if (current_condition['Field'] == condition['Field'] and
+ current_condition['SourceIpConfig']['Values'][0] == condition['SourceIpConfig']['Values'][0]):
condition_found = True
break
elif current_condition['Field'] == condition['Field'] and current_condition['Values'][0] == condition['Values'][0]:
@@ -731,7 +732,7 @@
modified_rule = {}
# Priority
- if current_rule['Priority'] != new_rule['Priority']:
+ if int(current_rule['Priority']) != new_rule['Priority']:
modified_rule['Priority'] = new_rule['Priority']
# Actions
@@ -753,6 +754,8 @@
if len(current_rule['Actions']) == 1 and len(new_rule['Actions']) == 1:
if current_rule['Actions'] != new_rule['Actions']:
modified_rule['Actions'] = new_rule['Actions']
+ print("modified_rule:")
+ print(new_rule['Actions'])
# if actions have multiple elements, we'll have to order them first before comparing.
# multiple actions will have an 'Order' key for this purpose
else:
@@ -773,9 +776,13 @@
if current_actions_sorted != new_actions_sorted_no_secret:
modified_rule['Actions'] = new_rule['Actions']
+ print("modified_rule:")
+ print(new_rule['Actions'])
# If the action lengths are different, then replace with the new actions
else:
modified_rule['Actions'] = new_rule['Actions']
+ print("modified_rule:")
+ print(new_rule['Actions'])
# Conditions
modified_conditions = []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment