diff options
author | Paul Belanger <pabelanger@redhat.com> | 2019-08-09 14:03:18 -0400 |
---|---|---|
committer | Paul Belanger <pabelanger@redhat.com> | 2019-08-09 15:16:14 -0400 |
commit | c841cad0ea6013aab5a0c5620d3b40d72ef5afc0 (patch) | |
tree | 71378646561c136f5a8ab5da4edfc064b23f51eb | |
parent | 66a01fb3cdcedff9205b2295870a7e1629bbae69 (diff) | |
download | vyos-ansible-old-c841cad0ea6013aab5a0c5620d3b40d72ef5afc0.tar.gz vyos-ansible-old-c841cad0ea6013aab5a0c5620d3b40d72ef5afc0.zip |
Add tox.ini file
Create a tox.ini file with linters entry point for developers to run
linters locally.
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
-rw-r--r-- | .zuul.yaml | 7 | ||||
-rw-r--r-- | plugins/module_utils/network/vyos/facts/facts.py | 5 | ||||
-rw-r--r-- | plugins/modules/vyos_system.py | 2 | ||||
-rw-r--r-- | plugins/modules/vyos_user.py | 1 | ||||
-rw-r--r-- | plugins/modules/vyos_vlan.py | 2 | ||||
-rw-r--r-- | requirements.txt | 0 | ||||
-rw-r--r-- | test-requirements.txt | 2 | ||||
-rw-r--r-- | tox.ini | 23 |
8 files changed, 33 insertions, 9 deletions
diff --git a/.zuul.yaml b/.zuul.yaml new file mode 100644 index 0000000..439cc66 --- /dev/null +++ b/.zuul.yaml @@ -0,0 +1,7 @@ +- project: + check: + jobs: + - ansible-tox-linters + gate: + jobs: + - ansible-tox-linters diff --git a/plugins/module_utils/network/vyos/facts/facts.py b/plugins/module_utils/network/vyos/facts/facts.py index fcb6bf0..eae9489 100644 --- a/plugins/module_utils/network/vyos/facts/facts.py +++ b/plugins/module_utils/network/vyos/facts/facts.py @@ -31,11 +31,6 @@ from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.legac Config, ) -from ansible.module_utils.network.vyos.vyos import ( - run_commands, - get_capabilities, -) - FACT_LEGACY_SUBSETS = dict(default=Default, neighbors=Neighbors, config=Config) FACT_RESOURCE_SUBSETS = dict( diff --git a/plugins/modules/vyos_system.py b/plugins/modules/vyos_system.py index 4f0d5db..3f306f8 100644 --- a/plugins/modules/vyos_system.py +++ b/plugins/modules/vyos_system.py @@ -215,7 +215,7 @@ def main(): if commands: commit = not module.check_mode - response = load_config(module, commands, commit=commit) + load_config(module, commands, commit=commit) result["changed"] = True module.exit_json(**result) diff --git a/plugins/modules/vyos_user.py b/plugins/modules/vyos_user.py index a309d2a..2bccd49 100644 --- a/plugins/modules/vyos_user.py +++ b/plugins/modules/vyos_user.py @@ -159,7 +159,6 @@ def validate_level(value, module): def spec_to_commands(updates, module): commands = list() - state = module.params["state"] update_password = module.params["update_password"] def needs_update(want, have, x): diff --git a/plugins/modules/vyos_vlan.py b/plugins/modules/vyos_vlan.py index 7c3fa69..6c0fad8 100644 --- a/plugins/modules/vyos_vlan.py +++ b/plugins/modules/vyos_vlan.py @@ -153,7 +153,6 @@ def map_obj_to_commands(updates, module): name = w["name"] address = w["address"] state = w["state"] - interfaces = w["interfaces"] obj_in_have = search_obj_in_list(vlan_id, have) @@ -236,7 +235,6 @@ def map_params_to_obj(module): def map_config_to_obj(module): objs = [] - interfaces = list() output = run_commands(module, "show interfaces") lines = output[0].strip().splitlines()[3:] diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/requirements.txt diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..4e92b9d --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,2 @@ +black +flake8 @@ -0,0 +1,23 @@ +[tox] +minversion = 1.4.2 +envlist = linters +skipsdist = True + +[testenv] +deps = -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt + +[testenv:linters] +install_command = pip install {opts} {packages} +commands = + black -v -l79 --check {toxinidir} + flake8 {posargs} + +[flake8] +# E123, E125 skipped as they are invalid PEP-8. + +show-source = True +ignore = E123,E125,E402,W503 +max-line-length = 160 +builtins = _ +exclude = .git,.tox |