From f05442f3d3f73069e0e90135b6f9c3c95943ec90 Mon Sep 17 00:00:00 2001 From: Sagar Paul Date: Tue, 17 Oct 2023 17:59:45 +0530 Subject: [PATCH 1/2] fix lint workflow, update reference (#586) * fix lint workflow, update reference * fix lint --- .ansible-lint | 3 +++ .github/workflows/lint.yml | 12 ++++++++++++ .github/workflows/tests.yml | 5 ----- changelogs/fragments/trivial_lint.yaml | 3 +++ 4 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/lint.yml create mode 100644 changelogs/fragments/trivial_lint.yaml diff --git a/.ansible-lint b/.ansible-lint index 0697b28d3..c97d3bfc0 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -1,4 +1,7 @@ --- +profile: production +exclude_paths: + - changelogs/changelog.yaml skip_list: # ansible-lint does not like the `import-3.11` ignore in tests/sanity/ignore-*.txt - sanity[cannot-ignore] diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 000000000..6890c6a8d --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,12 @@ +--- +name: ansible-lint +on: # yamllint disable-line rule:truthy + pull_request: + branches: ["main"] +jobs: + build: + name: Ansible Lint # Naming the build is important to use it as a status check + runs-on: ubuntu-latest + steps: + - name: Run ansible-lint + uses: ansible/ansible-lint@main # or version tag instead of 'main' diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9f210428f..6cd6ec7b6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,8 +11,6 @@ on: # yamllint disable-line rule:truthy workflow_dispatch: jobs: - ansible-lint: - uses: ansible-network/github_actions/.github/workflows/ansible-lint.yml@main changelog: uses: ansible-network/github_actions/.github/workflows/changelog.yml@main sanity: @@ -24,11 +22,9 @@ jobs: with: collection_pre_install: >- git+https://github.com/ansible-collections/ansible.utils.git - all_green: if: ${{ always() }} needs: - - ansible-lint - changelog - sanity - unit-galaxy @@ -38,7 +34,6 @@ jobs: - run: >- python -c "assert 'failure' not in set([ - '${{ needs.ansible-lint.result }}', '${{ needs.changelog.result }}', '${{ needs.sanity.result }}', '${{ needs.unit-galaxy.result }}', diff --git a/changelogs/fragments/trivial_lint.yaml b/changelogs/fragments/trivial_lint.yaml new file mode 100644 index 000000000..744f36321 --- /dev/null +++ b/changelogs/fragments/trivial_lint.yaml @@ -0,0 +1,3 @@ +--- +trivial: + - "Fix lint action reference." From 6099fe516680ab40d09171e4b58cfe271aa34231 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie?= Date: Tue, 17 Oct 2023 20:40:20 +0800 Subject: [PATCH 2/2] Fix parse_xml type for tmpl (#590) * Fix parse_xml type for tmpl * add changelog --------- Co-authored-by: Sagar Paul --- changelogs/fragments/fix_attribute_type.yaml | 3 +++ plugins/filter/parse_cli.py | 2 +- plugins/filter/parse_xml.py | 2 +- plugins/filter/vlan_expander.py | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/fix_attribute_type.yaml diff --git a/changelogs/fragments/fix_attribute_type.yaml b/changelogs/fragments/fix_attribute_type.yaml new file mode 100644 index 000000000..92fc370dd --- /dev/null +++ b/changelogs/fragments/fix_attribute_type.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: + - Fix attribute types from string to str in filter plugins. diff --git a/plugins/filter/parse_cli.py b/plugins/filter/parse_cli.py index c334a8d40..d9a3bb675 100644 --- a/plugins/filter/parse_cli.py +++ b/plugins/filter/parse_cli.py @@ -37,7 +37,7 @@ It defines how to parse the CLI output and return JSON data. - For example C(cli_data | ansible.netcommon.parse_cli(template.yml)), in this case C(cli_data) represents cli output. - type: string + type: str """ EXAMPLES = r""" diff --git a/plugins/filter/parse_xml.py b/plugins/filter/parse_xml.py index 78e45cfe8..0932971c7 100644 --- a/plugins/filter/parse_xml.py +++ b/plugins/filter/parse_xml.py @@ -36,7 +36,7 @@ It defines how to parse the XML output and return JSON data. - For example C(xml_data | ansible.netcommon.parse_xml(template.yml)), in this case C(xml_data) represents xml data option. - type: string + type: str """ EXAMPLES = r""" diff --git a/plugins/filter/vlan_expander.py b/plugins/filter/vlan_expander.py index b279564eb..359779916 100644 --- a/plugins/filter/vlan_expander.py +++ b/plugins/filter/vlan_expander.py @@ -27,7 +27,7 @@ data: description: - This option represents a string containing the range of vlans. - type: string + type: str required: True """