From 6d9762aef8307f8c46ab513acc38f6e7df89238f Mon Sep 17 00:00:00 2001 From: Dag Wieers Date: Wed, 25 Sep 2019 18:15:34 +0200 Subject: [PATCH] Fix whitespace issue in filter (backport 2.8) This fixes reported issue #60276 --- changelogs/fragments/aci-42-filter-whitespace.yaml | 2 ++ lib/ansible/module_utils/network/aci/aci.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/aci-42-filter-whitespace.yaml diff --git a/changelogs/fragments/aci-42-filter-whitespace.yaml b/changelogs/fragments/aci-42-filter-whitespace.yaml new file mode 100644 index 00000000000..389fbc9e2ef --- /dev/null +++ b/changelogs/fragments/aci-42-filter-whitespace.yaml @@ -0,0 +1,2 @@ +bugfixes: +- "ACI modules - Fix a whitespace issue in filters for ACI 4.2 strict validation" diff --git a/lib/ansible/module_utils/network/aci/aci.py b/lib/ansible/module_utils/network/aci/aci.py index de2ac674a1d..d223f1d3924 100644 --- a/lib/ansible/module_utils/network/aci/aci.py +++ b/lib/ansible/module_utils/network/aci/aci.py @@ -425,9 +425,9 @@ class ACIModule(object): ''' Build an APIC filter based on obj_class and key-value pairs ''' accepted_params = dict((k, v) for (k, v) in params.items() if v is not None) if len(accepted_params) == 1: - return ','.join('eq({0}.{1}, "{2}")'.format(obj_class, k, v) for (k, v) in accepted_params.items()) + return ','.join('eq({0}.{1},"{2}")'.format(obj_class, k, v) for (k, v) in accepted_params.items()) elif len(accepted_params) > 1: - return 'and(' + ','.join(['eq({0}.{1}, "{2}")'.format(obj_class, k, v) for (k, v) in accepted_params.items()]) + ')' + return 'and(' + ','.join(['eq({0}.{1},"{2}")'.format(obj_class, k, v) for (k, v) in accepted_params.items()]) + ')' def construct_url(self, root_class, subclass_1=None, subclass_2=None, subclass_3=None, child_classes=None): """