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 0000000..c5abb53 --- /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 cdfac7d..d319fac 100644 --- a/plugins/modules/api.py +++ b/plugins/modules/api.py @@ -79,7 +79,7 @@ options: 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. @@ -407,7 +407,7 @@ class ROS_api_module: 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: