Fix query (#68) (#69)

* 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 <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit a46c7df15c)

Co-authored-by: Nikolay Dachev <nikolay@dachev.info>
This commit is contained in:
patchback[bot] 2022-02-10 13:02:32 +01:00 committed by GitHub
parent a560bb696e
commit 093403212a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -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)."

View file

@ -79,7 +79,7 @@ options:
type: str type: str
query: query:
description: 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 is key word which extend query. WHERE format is key operator value - with spaces.
- WHERE valid operators are C(==), C(!=), C(>), C(<). - 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. - 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.
@ -407,7 +407,7 @@ class ROS_api_module:
def api_query(self): def api_query(self):
keys = {} keys = {}
for k in self.query: for k in self.query:
if 'id' in k and k != ".id": if k == 'id':
self.errors("'%s' must be '.id'" % k) self.errors("'%s' must be '.id'" % k)
keys[k] = Key(k) keys[k] = Key(k)
try: try: