From 9a1329153e4f8f4a4132e6937cb2817a0b03d2c8 Mon Sep 17 00:00:00 2001 From: Piotr Stawarski
Date: Tue, 14 Jan 2020 02:09:06 +0100 Subject: [PATCH] ec2_vol module filtering bug (#65960) * Update ec2_vol.py When `name` is specified, it ignores `zone` filter. That is you could not have same tag:Name in different zones. * Add changelog fragment --- changelogs/fragments/65960-ec2_vol-filtering-bugfix.yml | 2 ++ lib/ansible/modules/cloud/amazon/ec2_vol.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/65960-ec2_vol-filtering-bugfix.yml diff --git a/changelogs/fragments/65960-ec2_vol-filtering-bugfix.yml b/changelogs/fragments/65960-ec2_vol-filtering-bugfix.yml new file mode 100644 index 00000000000..6e6da5f6cb3 --- /dev/null +++ b/changelogs/fragments/65960-ec2_vol-filtering-bugfix.yml @@ -0,0 +1,2 @@ +bugfixes: + - "ec2_vol - fix filtering bug" diff --git a/lib/ansible/modules/cloud/amazon/ec2_vol.py b/lib/ansible/modules/cloud/amazon/ec2_vol.py index e86105f9b66..aeff60d06ea 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_vol.py +++ b/lib/ansible/modules/cloud/amazon/ec2_vol.py @@ -267,7 +267,7 @@ def get_volume(module, ec2): if zone: filters['availability_zone'] = zone if name: - filters = {'tag:Name': name} + filters['tag:Name'] = name if id: volume_ids = [id] try: