Skip to content

Commit

Permalink
Fix UnboundLocalError in sqs_queue (ansible-collections#389)
Browse files Browse the repository at this point in the history
* Fix UnboundLocalError in sqs_queue
The variable `existing_value` is nowhere to be found, but looks like
this might have been missed in a rename. Changing to `value`.

Fixes ansible-collections#172

* integration test
* changelog
Co-authored-by: Mark Chappell <[email protected]>
  • Loading branch information
leedm777 authored Mar 16, 2021
1 parent 528bdb5 commit 4d08f46
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changelogs/fragments/389-sqs-queue-UnboundLocalError.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- sqs_queue - fix UnboundLocalError when passing a boolean parameter (https://github.com/ansible-collections/community.aws/issues/172).
2 changes: 1 addition & 1 deletion plugins/modules/sqs_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ def update_sqs_queue(module, client, queue_url):

if isinstance(new_value, bool):
new_value = str(new_value).lower()
existing_value = str(existing_value).lower()
value = str(value).lower()

if new_value == value:
continue
Expand Down
22 changes: 22 additions & 0 deletions tests/integration/targets/sqs_queue/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,25 @@
with_items:
- { name: "{{ create_result.name }}" }
- { name: "{{ dead_letter_queue.name }}" }
- name: Test FIFO queue
block:
- name: Creating FIFO queue
sqs_queue:
name: "{{ resource_prefix }}{{ 1000 | random }}"
queue_type: fifo
content_based_deduplication: yes
register: create_result
- name: Assert queue created with configuration
assert:
that:
- create_result.changed
always:
- name: Cleaning up queue
sqs_queue:
name: "{{ item.name }}"
state: absent
register: delete_result
retries: 3
delay: 3
with_items:
- { name: "{{ create_result.name }}" }

0 comments on commit 4d08f46

Please sign in to comment.