diff --git a/changelogs/fragments/52-netscaler_nitro_request-use-all-filters.yaml b/changelogs/fragments/52-netscaler_nitro_request-use-all-filters.yaml new file mode 100644 index 00000000..183d38f7 --- /dev/null +++ b/changelogs/fragments/52-netscaler_nitro_request-use-all-filters.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: + - netscaler_nitro_request - use all filters for get_filtered instead of only the first one (https://github.com/ansible-collections/community.network/issues/48). diff --git a/plugins/modules/network/netscaler/netscaler_nitro_request.py b/plugins/modules/network/netscaler/netscaler_nitro_request.py index 20c9d0d2..e9c862f1 100644 --- a/plugins/modules/network/netscaler/netscaler_nitro_request.py +++ b/plugins/modules/network/netscaler/netscaler_nitro_request.py @@ -642,10 +642,7 @@ def get_filtered(self): if self._module.params['filter'] is None: self.fail_module(msg='NITRO filter is undefined.') - keys = list(self._module.params['filter'].keys()) - filter_key = keys[0] - filter_value = self._module.params['filter'][filter_key] - filter_str = '%s:%s' % (filter_key, filter_value) + filter_str = ','.join('%s:%s' % (k, v) for k, v in self._module.params['filter'].items()) url = '%s://%s/nitro/v1/config/%s?filter=%s' % ( self._module.params['nitro_protocol'],