Commit graph

21 commits

Author SHA1 Message Date
Felix Fontein
af6524a1fd
Fix docs. (#105) 2022-08-04 14:32:01 +02:00
Felix Fontein
2911710f1b
Add api_info and api_modify modules (#91)
* Add api_info and api_modify modules.

* Add documentation, and cross-references for the modules.

* Bump version added for new modules.

* Ignore dynamic entries. Allow _info module to return them.

* Document behavior for dynamic entries.

* Update license headers.

* Add disclaimer.

* Improve formulation.

* Auto-generate path list in DOCUMENTATION.

* Add test to make sure lists have been generated automatically.
2022-07-31 22:06:19 +02:00
Felix Fontein
7973f58661
Move licenses to LICENSES/, use SPDX-License-Identifier, mention all licenses in galaxy.yml, add missing license file (#101)
* Add SPDX license identifiers, mention all licenses in galaxy.yml.

* Add default copyright headers.

* Adjust remaining/missing entries.

* Fix/add more copyright statements.

* Add sanity test.

* Add changelog.

* Add missing license file.

* Remove colon after 'Copyright'.

* Avoid colon after 'Copyright' in lint script.
2022-07-18 23:16:54 +02:00
Felix Fontein
023f11f7e1
Add encoding option to API modules (#95)
* Set encoding to UTF-8.

* Add encoding parameter to API modules.

* librouteros is now patched.
2022-05-24 22:19:26 +02:00
Nikolay Dachev
d57de117f5
update community.routeros.api query functionality (#63)
* update query to accept multiple librouteros ADN parameters

* update query for new yml strucutre

* add extended_query as separate function:(code in progress)

* extended_query main code is ready for review

* add changelog #63

* small fix for code indentation

* fix pep

* clear all pep issues

* extended_query ready for review (new yml structure)

* small doc fix for std query

* Update changelogs/fragments/63-add-extended_query.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update changelogs/fragments/63-add-extended_query.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update argument spec.

* Other suggestions.

* Fix syntax errors ('is' and 'or' are keywords).

* Make everything work again.

* Add docs, simplify code.

* Add some first tests.

* Do not add fake message when there is no search result.

* Improve tests.

* Fix tests.

* update extened query docs and ros api module examples

* fix pep plugins/modules/api.py:154:1: W293: blank line contains whitespace

* fix extended query example intend

* Update plugins/modules/api.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/api.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* fix example docs

Co-authored-by: dako <dako@syslin.sof.dachev.lan>
Co-authored-by: Felix Fontein <felix@fontein.de>
2022-05-23 14:44:02 +03:00
Felix Fontein
3d80ccec5f
Add api_facts module (#88)
* Add API docs fragment.

* Improve documentation.

* Move API code to api module_utils.

* Improve docs.

* Add api_facts module.

Does not yet support 'config'. I'm not sure whether that's actually
possible with the API.

* Convert subnet to integer if possible.

* Cleanup.

* Linting and fix tests.

* Remove things that make no sense.

* Simplify code.

* Add basic tests.

* Lint.
2022-05-12 16:17:43 +02:00
Nikolay Dachev
a46c7df15c
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 <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-02-10 07:53:08 +01:00
Felix Fontein
d73eb1c144
Add module_utils and filters for quoting and unquoting (#53)
* Move splitting code to own file.

* Move list to dictionary code to quoting as well.

* Add quoting functionality.

* Add quoting filters.

* Add integration tests to CI.

* Fix bugs, increase coverage.

* Make parsing more strict.

* Extract function parse_argument_value from split_routeros_command to make proper parsing of WHERE possible.

* Adjust expected error message in integration tests.

* Simplify code and improve coverage.

* Add changelog fragment for WHERE strictness in api module.

* Add documenation.

* Fix typo.

* Add documentation references.

* Add example to api module which uses quote_argument_value.

* Fix bug, and add tests which prevent this in the future.

* Add more escape sequence tests.

* Make sure all control characters are quoted.
2021-10-12 00:44:40 +03:00
Akim Lindberg
5042905471
fix(api): fixed a bug when splitting the argument string (#45)
* fix(api): fixed a bug when splitting the argument string

* fix(api): added the shlex module for splitting

* fix(api): added the shlex module for splitting

* fix(api): moved shlex.split to self method split_params

* Fix indentation.

* Implement custom splitting algorithm.

* Raise AssertionError in case of internal error.

* Update plugins/modules/api.py

this is correct thanks !

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Nikolay Dachev <nikolay@dachev.info>
2021-09-29 15:02:28 +02:00
Felix Fontein
48c7920072
Improve split handling. (#47) 2021-09-09 23:19:57 +03:00
Felix Fontein
69682054e1
Allow api module to fail (#39)
* Allow api module to fail.

* Improve error handling.

* Fix api unit tests.

* Add very basic tests of return values.

* Update api.py

fix ignoring the Fail task if we get TrapError

* Do not mangle fail result, and adjust tests.

* Improve changelog fragment.

* Reclassify changelog fragment as minor_changes, improve text.

* Mark changelog as 'breaking change'.

Co-authored-by: Nikolay Dachev <nikolay@dachev.info>
2021-07-11 15:53:22 +02:00
Felix Fontein
75b4b966a6
Add options to control certificate validation for api module (#37)
* Add options to control certificate validation for api module.

* Linting.

* Extend documentation.

* Fix validate_cert_hostname=true.

* Add documentation on setting up certificates on a RouterOS device.
2021-06-28 20:33:37 +02:00
Felix Fontein
937aa0dbfa
Replace ansible.module_utils._text by ansible.module_utils.common.text.converters (#38)
* Replace ansible.module_utils._text by ansible.module_utils.common.text.converters.

* One more.
2021-06-27 09:53:45 +02:00
Jadyn
b45baaa158
Disable use of deprecated Ciphers (#34)
* Disable use of depricated Ciphers

Old ciphers shouldn't be used. Devices that use newer ciphers couldn't be reached as the cipher was locked to sslv3.

* chore: add changelog fragment
2021-06-15 19:14:34 +02:00
Nikolay Dachev
6c618cab26
remove .id restriction for list_to_dic (#15)
* remove .id restriction for list_to_dic

* add change log

* Update changelogs/fragments/13-remove-id-restriction-for-api.yaml

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: dako <dako@syslin.sof.dachev.lan>
Co-authored-by: Felix Fontein <felix@fontein.de>
2020-12-10 23:43:03 +02:00
Felix Fontein
649809b2be
Fix bool default value. (#12) 2020-11-22 20:46:05 +03:00
Felix Fontein
ed0c7d377e
More docs updates (#4)
* Fix names.

* Remove superfluous tasks:.
2020-10-28 09:22:02 +02:00
Felix Fontein
3c0df4b343
Fix crash when ssl parameter of api is used. (#3)
tested from me as well, thanks again !
2020-10-27 13:08:57 +02:00
Felix Fontein
5368e44f83
Improve docs (#2) 2020-10-27 14:05:19 +03:00
Felix Fontein
e1d0864335 Remove version_added's that refer to other collections. 2020-10-26 20:28:15 +01:00
Nikolay Dachev
cc273e7ec1 add api.py (#97)
* add api.py

* fix yaml

* query doc fix

* query doc fix

* fix exmaples

* dummy force retest

* fix small typo in RETURN

* remove no_log which conflict with routeros add param.

* fix pep8

* fix no_log conflict base on issue: password/pass no_log #49465

* ver 1.0.1

* small docs change

* more docs fix

* last one for docs change

* pip8 fix

* Update plugins/modules/api.py

I did not nice that .. Thank you!

Co-authored-by: Felix Fontein <felix@fontein.de>

* remove metadata block

* do not allow empty values to be added in execution path

* Update plugins/modules/api.py

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* fixes for the last  review

* Apply suggestions from code review

more fixes

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* small changes in examples 'a' vs 'A'

* Apply suggestions from code review

more docs string fixes

Co-authored-by: Felix Fontein <felix@fontein.de>

* fixses in docs, reomve no_logs

* fix example vars

* fix again example a/A

* missing C in C()

* add external conn func

* fix pep8

* fix pep8 test2

* fix pep8 test3

* fix HAS_LIB

* return Ex as e

* fix pep8

* api unit test

* change unit test, change module structure

* pep8 fix

* more pep8

* some progress with unit test

* mm fix

* mock libros fix

* test

* try to fix mock

* test

* test mock

* more unit test

* libtoueros py3 only

* pytest importskyp added

* more unit test

* add update func unit test

* +more unit, fix mutually_exclusive

* fix missed , for module arg

* Apply suggestions from code review

typos fixes

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* Update plugins/modules/api.py

will fix others as well

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* fix docs

* small doc fix

* fix missing dots etc. in doc

* unit test completed

* reduce dummy Key func

* fix Key return

* final fix

* fix pep8

* fix pep8

Co-authored-by: root <root@syslin.sof.dachev.lan>
Co-authored-by: Nikolay Dachev <dako@Uranus.sof.dachev.lan>
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
2020-10-26 15:18:40 +01:00