From a46c7df15c1e487367fbf12cf27b52c8678d1b3b Mon Sep 17 00:00:00 2001 From: Nikolay Dachev Date: Thu, 10 Feb 2022 08:53:08 +0200 Subject: [PATCH] Fix query (#68) * fix issues #67 * fix query id check * add changelog fragment * fix changelog fragment new line * fix changelog fragment new line2 * Update changelogs/fragments/68-fix-query-id-check.yml Co-authored-by: Felix Fontein Co-authored-by: Felix Fontein --- changelogs/fragments/68-fix-query-id-check.yml | 2 ++ plugins/modules/api.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/68-fix-query-id-check.yml diff --git a/changelogs/fragments/68-fix-query-id-check.yml b/changelogs/fragments/68-fix-query-id-check.yml new file mode 100644 index 00000000..c5abb534 --- /dev/null +++ b/changelogs/fragments/68-fix-query-id-check.yml @@ -0,0 +1,2 @@ +bugfixes: + - "query - fix query function check for ``.id`` vs. ``id`` arguments to not conflict with routeros arguments like ``identity`` (https://github.com/ansible-collections/community.routeros/pull/68, https://github.com/ansible-collections/community.routeros/issues/67)." diff --git a/plugins/modules/api.py b/plugins/modules/api.py index 2fe904c8..e4e716c8 100644 --- a/plugins/modules/api.py +++ b/plugins/modules/api.py @@ -79,7 +79,7 @@ type: str query: description: - - Query given path for selected query attributes from RouterOS aip and return '.id'. + - Query given path for selected query attributes from RouterOS aip. - WHERE is key word which extend query. WHERE format is key operator value - with spaces. - WHERE valid operators are C(==), C(!=), C(>), C(<). - Example path C(ip address) and query C(.id address) will return only C(.id) and C(address) for all items in C(ip address) path. @@ -439,7 +439,7 @@ def api_update(self): def api_query(self): keys = {} for k in self.query: - if 'id' in k and k != ".id": + if k == 'id': self.errors("'%s' must be '.id'" % k) keys[k] = Key(k) try: