diff --git a/.config/ansible-lint.yml b/.ansible-lint similarity index 97% rename from .config/ansible-lint.yml rename to .ansible-lint index 879a5493..6f224691 100644 --- a/.config/ansible-lint.yml +++ b/.ansible-lint @@ -1,6 +1,5 @@ --- profile: production -strict: true skip_list: - ignore-errors # Use failed_when and specify error conditions instead of using ignore_errors. - meta-no-info # meta/main.yml should contain relevant info. diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 2aa8b9e5..bf13c4d5 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -11,10 +11,3 @@ on: jobs: linters: uses: ansible-network/github_actions/.github/workflows/tox-linters.yml@main - ansible-lint: - runs-on: ubuntu-latest - steps: - - uses: ansible-network/github_actions/.github/actions/checkout_dependency@main - - - name: run-ansible-lint - uses: ansible/ansible-lint@v25.1.2 diff --git a/.github/workflows/sanity.yml b/.github/workflows/sanity.yml index 75760b5d..06d885a4 100644 --- a/.github/workflows/sanity.yml +++ b/.github/workflows/sanity.yml @@ -33,18 +33,38 @@ jobs: "ansible-version": "milestone", "python-version": "3.10" }, + { + "ansible-version": "stable-2.20", + "python-version": "3.10" + }, + { + "ansible-version": "stable-2.20", + "python-version": "3.11" + }, { "ansible-version": "stable-2.19", "python-version": "3.10" }, + + "ansible-version": "stable-2.19", + "python-version": "3.14" + }, { "ansible-version": "stable-2.18", "python-version": "3.10" }, + { + "ansible-version": "stable-2.18", + "python-version": "3.14" + }, { "ansible-version": "stable-2.17", "python-version": "3.13" }, + { + "ansible-version": "stable-2.17", + "python-version": "3.14" + }, { "ansible-version": "stable-2.16" } diff --git a/galaxy.yml b/galaxy.yml index d41a243c..695d4a68 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -17,8 +17,8 @@ tags: - infrastructure - cluster dependencies: - amazon.aws: '>=5.1.0' - community.aws: '>=5.0.0' + amazon.aws: '>=10.0.0,<12.0.0-dev0' + community.aws: '>=10.0.0,<12.0.0-dev0' amazon.cloud: '>=0.4.0' community.libvirt: '>=1.2.0' version: 5.0.0-dev0 diff --git a/plugins/modules/validate_network_acls.py b/plugins/modules/validate_network_acls.py index 007c73ce..c02e6f8f 100644 --- a/plugins/modules/validate_network_acls.py +++ b/plugins/modules/validate_network_acls.py @@ -96,10 +96,10 @@ sample: 'Network ACL validation successful' """ -from ipaddress import ip_network, ip_address from collections import namedtuple -from ansible.module_utils.basic import AnsibleModule +from ipaddress import ip_address, ip_network +from ansible.module_utils.basic import AnsibleModule # NACL Entry format # [ diff --git a/plugins/modules/validate_route_tables.py b/plugins/modules/validate_route_tables.py index 7e8f8da0..1438ce5f 100644 --- a/plugins/modules/validate_route_tables.py +++ b/plugins/modules/validate_route_tables.py @@ -137,7 +137,7 @@ interface_id: null network_interface_id: null origin: "CreateRoute" - state": "active" + state: "active" vpc_id: "vpc-0bee28efef41e1de4" dest_vpc_route_tables: - associations: @@ -166,7 +166,7 @@ interface_id: null network_interface_id: null origin: "CreateRoute" - state": "active" + state: "active" vpc_id: "vpc-0bee28efef41e1de4" src_subnets: - assign_ipv6_address_on_creation: false @@ -184,7 +184,7 @@ owner_id: "00000000000" private_dns_name_options_on_launch: enable_resource_name_dns_a_record: false - enable_resource_name_dns_aaaa_record": false + enable_resource_name_dns_aaaa_record: false hostname_type: "ip-name" state: "available" subnet_arn: "arn:aws:ec2:eu-west-2:721066863947:subnet/subnet-0af56e0d353f88cb8" @@ -260,8 +260,8 @@ sample: 'Route table validation successful' """ -from ipaddress import ip_network import copy +from ipaddress import ip_network from ansible.module_utils.basic import AnsibleModule diff --git a/plugins/modules/validate_security_group_rules.py b/plugins/modules/validate_security_group_rules.py index fe858bcf..0819ab27 100644 --- a/plugins/modules/validate_security_group_rules.py +++ b/plugins/modules/validate_security_group_rules.py @@ -117,8 +117,8 @@ sample: 'Security Group validation successful' """ -from ipaddress import ip_network, ip_address import copy +from ipaddress import ip_address, ip_network from ansible.module_utils.basic import AnsibleModule diff --git a/tox.ini b/tox.ini index e10d8cc2..a3b64527 100644 --- a/tox.ini +++ b/tox.ini @@ -1,36 +1,73 @@ [tox] -minversion = 1.4.2 +minversion = 4.0 skipsdist = True +[common] +format_dirs = {toxinidir}/plugins {toxinidir}/tests + [testenv] -deps = -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt +deps = -r {toxinidir}/test-requirements.txt install_command = pip install {opts} {packages} -[testenv:black] +[testenv:ansible-lint] +description = Run ansible-lint deps = - black >= 23.0, < 24.0 + ansible-lint >= 25.1.2 +commands = ansible-lint +[testenv:black] +description = Lint against "black" formatting standards +deps = + black >= 24.0, < 25.0 commands = - black {toxinidir}/plugins {toxinidir}/tests + black --check --diff {[common]format_dirs} -[testenv:ansible-lint] +[testenv:black_format] +description = Apply "black" formatting deps = - ansible-lint >= 25.1.2 -changedir = {toxinidir} + {[testenv:black]deps} commands = - ansible-lint + black -v {[common]format_dirs} -[testenv:linters] +[testenv:flake8] deps = - yamllint flake8 +commands = + flake8 {[common]format_dirs} + +[testenv:isort] +description = Lint for import sorting +deps = + isort +commands = + isort --check-only --diff {[common]format_dirs} + +[testenv:isort_format] +description = Sort imports +deps = + {[testenv:isort]deps} +commands = + isort -v {[common]format_dirs} + +[testenv:format] +deps = {[testenv:black]deps} + {[testenv:isort]deps} +commands = + {[testenv:black]commands} + {[testenv:isort]commands} +[testenv:linters] +deps = + {[testenv:black]deps} + {[testenv:flake8]deps} + {[testenv:isort]deps} + {[testenv:ansible-lint]deps} commands = - black -v --check --diff {toxinidir}/plugins {toxinidir}/tests - yamllint -s {toxinidir} - flake8 {toxinidir} + {[testenv:black]commands} + {[testenv:flake8]commands} + {[testenv:isort]commands} + {[testenv:ansible-lint]commands} [testenv:sanity] deps = ansible