Skip to content

Commit e3f261e

Browse files
Ansible-lint changes to satisfy certificate requirements (#551)
* dcnm_policy and dcnm_vrf changes in integ tests * Initial lint changes * Partial ansible-lint fixes applied - Fixed galaxy.yml license format (string to array) - Replaced deprecated include with include_tasks - Removed trailing spaces from all YAML files - Converted truthy values (yes/no to true/false) - Added space after # in comments - Fixed sanity ignore files (removed invalid patterns) - Added missing task names (179 files) - Added FQCN prefix to builtin modules - Fixed free-form set_fact statements - Applied automated YAML formatting fixes * Fix schema violations - convert old-style include to include_tasks with proper YAML format * Partial ansible-lint fixes applied 1. Schema Violations - Replaced deprecated include with ansible.builtin.include_tasks - Fixed old-style include directives 2. Naming Violations - Capitalized task names that started with lowercase letters - Added names to plays and tasks that were missing them - Fixed naming issues 3. YAML Truthy Violations - Converted True/False to lowercase true/false 4. Indentation Violations - Corrected wrong indentation - Fixed expected vs found indentation mismatches 5. YAML Formatting Issues - Fixed trailing spaces - Removed excessive empty lines - Corrected colon spacing - Fixed bracket spacing 6. FQCN Violations - Added ansible.builtin prefix to core module calls - Applied to include_tasks, set_fact, debug, etc. 7. Module Docstring YAML Errors - Fixed syntax errors - Removed excess blank lines in documentation strings - Corrected YAML formatting in EXAMPLES sections 8. Miscellaneous Fixes - Fixed no-free-form violations in set_fact calls - Corrected var-naming pattern - Fixed jinja2 spacing * Partial ansible-lint fixes applied * Fix YAML load-failure errors: indentation issues - Fixed playbooks/roles/dcnm_inventory/dcnm_tests.yml (duplicate name key) - Fixed dcnm_bootflash tests (filepath list indentation, set_fact indentation, assert indentation) - Fixed dcnm_image_policy_query.yaml (assert that: block indentation) Reduced load-failure errors from 127 to 122. * Fix YAML load-failure errors: indentation and structure issues - Fixed playbooks/roles/dcnm_inventory/dcnm_tests.yml (duplicate name key, list format) - Fixed dcnm_bootflash tests (3 files: filepath indentation, set_fact indentation, assert blocks) - Fixed dcnm_image_policy_query.yaml (partial: assert that: block indentation) - Restored dcnm_service_node/tasks/main.yaml (45 lines of version detection logic) Reduced load-failure errors from 127 to 122. * Add .ansible cache directory to gitignore * Partial lint-changes * Fix YAML indentation issues: assert blocks (6-space), list items alignment, config structures - reduced errors 122→111 * Cleanup of previous temp files and additional changes * Remove .ansible symlink directory from repository * temporary file removal * Fix ansible-lint errors: YAML indentation, inline that, malformed assert blocks, and duplicate asserts - Fixed GitHub workflow indentation (7 errors) - Fixed 31 files with list item indentation issues - Fixed 72 files with inline 'that:' after 'assert:' - Fixed 39 files with malformed assert blocks - Fixed 39 files with duplicate assert declarations - Fixed 41 files with tasks wrongly nested under assert blocks - Manually fixed 7 files (dcnm_image_upgrade, dcnm_inventory, dcnm_links) - Created 6 automation scripts for systematic fixes - Progress: Fixed ~200+ errors out of 361 total * Fix assert condition indentation inconsistencies - Fixed 22 files with inconsistent assert condition list indentation - Created fix_assert_condition_indent.py script - Conditions in assert blocks now have consistent indentation throughout - Fixes 'did not find expected key' errors in dcnm_vrf, dcnm_service_node, and module_integration tests - Progress: dcnm_vrf errors reduced from 6 to 2 * partial set of lint fixes * Another set of partial lint fixes * Normalize YAML indentation in VRF overridden and fabric_setup playbooks; ensure clean parse and consistent block task alignment * Intermediate changes for resolving lint-errors * fix: normalize YAML structure in dcnm_policy_delete integration test (separate summary/response asserts, correct indentation, anchors) * style: ensure overridden service policy test YAML parses; minor header comments retained * fix(service_policy): correct indentation under block for query/replace/sanity YAML tests (parse warnings resolved) * addressing intermediate lint failures - last 5 percent * Last set of lint changes * remove intermediate files * fix: update .ansible-lint to skip load-failure warnings for workflows - Added .github/workflows/ to exclude_paths (more specific path) - Added load-failure to skip_list to ignore file-not-found warnings - This prevents workflow file errors from blocking linting * Change in dependency style * Manual fixes to correct the new changes * Intermediate lint changes with manual correction * Intermediate manual corrections * Intermediate changes for better visibility of diff * changes with module integ files * Recheck failures address * vrf tests files - second round of review changes * second round of review changes in sr_peering tests * Second round of review changes * Final set of lint changes * Removing local changes * Addressing review comments * Merged file addition * dcnm_vrf modify file * Spacing changes in the diff output from ND * Spacing changes recommended * Removal of repetitive lines * Minor changes * Addressing review comments on request_path strings and bool * Specific Line length failure * Resolving merge conflict * Resolving spacing issues in the expected output * Manual verification of lint changes * Restoring test and host files * Final changes for lint from repo * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Fabric group lint issues addressal * Line length lint issues addressal for review * nxos dependency installation for lint job * Removing lint job from github actions temporarily * Integ test lint fixes * Addressing assert allignment for IT * Integ test corrections for lint * Playbook files changes removed * Changes resolved as in the repo * Final changes on the self review * github workflow file changes
1 parent 7e1681c commit e3f261e

File tree

358 files changed

+18238
-16673
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

358 files changed

+18238
-16673
lines changed

.ansible-lint

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
# Ansible-lint configuration file
3+
# See https://ansible.readthedocs.io/projects/lint/configuring/
4+
5+
profile: production
6+
7+
# Exclude paths from linting - GitHub workflows should not be linted
8+
exclude_paths:
9+
- .github/workflows/main.yml

.github/workflows/main.yml

Lines changed: 78 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ name: CI
66
on:
77
# Triggers the workflow on push or pull request events but only for the develop branch
88
push:
9-
branches: [ develop, main ]
9+
branches: [develop, main]
1010
pull_request:
11-
branches: [ develop, main ]
11+
branches: [develop, main]
1212

1313
# Allows you to run this workflow manually from the Actions tab
1414
workflow_dispatch:
@@ -23,32 +23,32 @@ jobs:
2323
matrix:
2424
ansible: [2.15.13, 2.16.14, 2.17.12, 2.18.6]
2525
steps:
26-
- name: Check out code
27-
uses: actions/checkout@v2
28-
29-
- name: Set up Python "3.11"
30-
uses: actions/setup-python@v1
31-
with:
32-
python-version: "3.11"
26+
- name: Check out code
27+
uses: actions/checkout@v2
3328

34-
- name: Install ansible-base (v${{ matrix.ansible }})
35-
run: pip install https://github.com/ansible/ansible/archive/v${{ matrix.ansible }}.tar.gz --disable-pip-version-check
29+
- name: Set up Python "3.11"
30+
uses: actions/setup-python@v1
31+
with:
32+
python-version: "3.11"
3633

37-
- name: Build a DCNM collection tarball
38-
run: ansible-galaxy collection build --output-path "${GITHUB_WORKSPACE}/.cache/v${{ matrix.ansible }}/collection-tarballs"
34+
- name: Install ansible-base (v${{ matrix.ansible }})
35+
run: pip install https://github.com/ansible/ansible/archive/v${{ matrix.ansible }}.tar.gz --disable-pip-version-check
3936

40-
- name: Store migrated collection artifacts
41-
uses: actions/upload-artifact@v4.4.0
42-
with:
43-
name: collection_v${{ matrix.ansible }}
44-
path: .cache/v${{ matrix.ansible }}/collection-tarballs
45-
overwrite: true
37+
- name: Build a DCNM collection tarball
38+
run: ansible-galaxy collection build --output-path "${GITHUB_WORKSPACE}/.cache/v${{ matrix.ansible }}/collection-tarballs"
39+
40+
- name: Store migrated collection artifacts
41+
uses: actions/upload-artifact@v4.4.0
42+
with:
43+
name: collection_v${{ matrix.ansible }}
44+
path: .cache/v${{ matrix.ansible }}/collection-tarballs
45+
overwrite: true
4646

4747

4848
sanity:
4949
name: Run ansible-sanity tests
5050
needs:
51-
- build
51+
- build
5252
runs-on: ubuntu-latest
5353
strategy:
5454
matrix:
@@ -64,75 +64,75 @@ jobs:
6464
- ansible: 2.18.6
6565
python: "3.10"
6666
steps:
67-
- name: Set up Python (v${{ matrix.python }})
68-
uses: actions/setup-python@v1
69-
with:
70-
python-version: ${{ matrix.python }}
67+
- name: Set up Python (v${{ matrix.python }})
68+
uses: actions/setup-python@v1
69+
with:
70+
python-version: ${{ matrix.python }}
7171

72-
- name: Install ansible-base (v${{ matrix.ansible }})
73-
run: pip install https://github.com/ansible/ansible/archive/v${{ matrix.ansible }}.tar.gz --disable-pip-version-check
72+
- name: Install ansible-base (v${{ matrix.ansible }})
73+
run: pip install https://github.com/ansible/ansible/archive/v${{ matrix.ansible }}.tar.gz --disable-pip-version-check
7474

75-
- name: Download migrated collection artifacts
76-
uses: actions/download-artifact@v4.1.7
77-
with:
78-
name: collection_v${{ matrix.ansible }}
79-
path: .cache/v${{ matrix.ansible }}/collection-tarballs
75+
- name: Download migrated collection artifacts
76+
uses: actions/download-artifact@v4.1.7
77+
with:
78+
name: collection_v${{ matrix.ansible }}
79+
path: .cache/v${{ matrix.ansible }}/collection-tarballs
8080

81-
- name: Install the collection tarball
82-
run: ansible-galaxy collection install .cache/v${{ matrix.ansible }}/collection-tarballs/*.tar.gz
81+
- name: Install the collection tarball
82+
run: ansible-galaxy collection install .cache/v${{ matrix.ansible }}/collection-tarballs/*.tar.gz
8383

84-
- name: Run sanity tests
85-
run: ansible-test sanity --docker --python ${{matrix.python}} -v --color --truncate 0
86-
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/dcnm
84+
- name: Run sanity tests
85+
run: ansible-test sanity --docker --python ${{matrix.python}} -v --color --truncate 0
86+
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/dcnm
8787

8888

8989
unit-tests:
9090
name: Run DCNM Unit Tests
9191
needs:
92-
- build
92+
- build
9393
runs-on: ubuntu-latest
9494
strategy:
9595
matrix:
9696
ansible: [2.15.13, 2.16.14, 2.17.12, 2.18.6]
9797
steps:
98-
- name: Set up Python "3.11"
99-
uses: actions/setup-python@v1
100-
with:
101-
python-version: "3.11"
102-
103-
- name: Install ansible-base (v${{ matrix.ansible }})
104-
run: pip install https://github.com/ansible/ansible/archive/v${{ matrix.ansible }}.tar.gz --disable-pip-version-check
105-
106-
- name: Install Pydantic (v2)
107-
run: pip install pydantic==2.11.10
108-
109-
- name: Install Requests
110-
run: pip install requests==2.32.5
111-
112-
- name: Install DeepDiff (v8.5.0)
113-
run: pip install deepdiff==8.5.0
114-
115-
- name: Install coverage (v7.3.4)
116-
run: pip install coverage==7.3.4
117-
118-
- name: Install pytest (v7.4.4)
119-
run: pip install pytest==7.4.4
120-
121-
- name: Download migrated collection artifacts
122-
uses: actions/download-artifact@v4.1.7
123-
with:
124-
name: collection_v${{ matrix.ansible }}
125-
path: .cache/v${{ matrix.ansible }}/collection-tarballs
126-
127-
- name: Install the collection tarball
128-
run: ansible-galaxy collection install .cache/v${{ matrix.ansible }}/collection-tarballs/*.tar.gz
129-
130-
- name: Run DCNM Unit tests
131-
run: coverage run --source=. -m pytest tests/unit/. -vvvv
132-
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/dcnm
133-
env:
134-
PYTHONPATH: /home/runner/.ansible/collections
135-
136-
- name: Generate coverage report
137-
run: coverage report
138-
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/dcnm
98+
- name: Set up Python "3.11"
99+
uses: actions/setup-python@v1
100+
with:
101+
python-version: "3.11"
102+
103+
- name: Install ansible-base (v${{ matrix.ansible }})
104+
run: pip install https://github.com/ansible/ansible/archive/v${{ matrix.ansible }}.tar.gz --disable-pip-version-check
105+
106+
- name: Install Pydantic (v2)
107+
run: pip install pydantic==2.11.10
108+
109+
- name: Install Requests
110+
run: pip install requests==2.32.5
111+
112+
- name: Install DeepDiff (v8.5.0)
113+
run: pip install deepdiff==8.5.0
114+
115+
- name: Install coverage (v7.3.4)
116+
run: pip install coverage==7.3.4
117+
118+
- name: Install pytest (v7.4.4)
119+
run: pip install pytest==7.4.4
120+
121+
- name: Download migrated collection artifacts
122+
uses: actions/download-artifact@v4.1.7
123+
with:
124+
name: collection_v${{ matrix.ansible }}
125+
path: .cache/v${{ matrix.ansible }}/collection-tarballs
126+
127+
- name: Install the collection tarball
128+
run: ansible-galaxy collection install .cache/v${{ matrix.ansible }}/collection-tarballs/*.tar.gz
129+
130+
- name: Run DCNM Unit tests
131+
run: coverage run --source=. -m pytest tests/unit/. -vvvv
132+
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/dcnm
133+
env:
134+
PYTHONPATH: /home/runner/.ansible/collections
135+
136+
- name: Generate coverage report
137+
run: coverage report
138+
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/dcnm

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,4 @@ venv.bak/
7979
.mypy_cache/
8080

8181
# Ignore Integration Tests Files Directories
82-
tests/integration/targets/*/files
82+
tests/integration/targets/*/files

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"python.testing.pytestArgs": ["tests"],
33
"python.testing.unittestEnabled": false,
4-
"python.testing.pytestEnabled": true
4+
"python.testing.pytestEnabled": true,
55
}

galaxy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ authors:
1515
- Neil John <neiljohn-gh>
1616
- Sivakami Sivaraman <sivakasi-cisco>
1717
description: Ansible collection for the Cisco Nexus® Dashboard Fabric Controller (NDFC) - formerly DCNM
18-
license: Apache-2.0
18+
license: [Apache-2.0]
1919
tags: [cisco, ndfc, dcnm, nxos, networking, vxlan]
2020
dependencies:
2121
"ansible.netcommon": ">=4.1.0"

meta/runtime.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
# The example below demonstrates how running the dcnm_inventory module
33
# will redirect to a common action plugin called cisco.dcnm.dcnm
44
#
5-
#---
5+
# ---
66
requires_ansible: ">=2.15.0"
7-
#plugin_routing:
7+
# plugin_routing:
88
# action:
99
# dcnm_inventory:
1010
# redirect: cisco.dcnm.dcnm

playbooks/roles/dcnm_bootflash/create_files.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
2-
- gather_facts: false
2+
- name: Create bootflash files on switch1
3+
gather_facts: false
34
hosts:
45
- switch1
56
tasks:
@@ -13,7 +14,8 @@
1314
- echo 1 > bootflash:/{{ nxos_vars.switch1_file3 }}
1415
- echo 1 > bootflash:/{{ nxos_vars.switch1_file4 }}
1516

16-
- gather_facts: false
17+
- name: Create bootflash files on switch2
18+
gather_facts: false
1719
hosts:
1820
- switch2
1921
tasks:

playbooks/roles/dcnm_bootflash/dcnm_hosts.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ all:
33
ansible_user: "admin"
44
ansible_password: "password-secret"
55
ansible_python_interpreter: python
6-
ansible_httpapi_validate_certs: False
7-
ansible_httpapi_use_ssl: True
6+
ansible_httpapi_validate_certs: false
7+
ansible_httpapi_use_ssl: true
88
children:
99
dcnm:
1010
vars:
@@ -15,7 +15,7 @@ all:
1515
nxos:
1616
vars:
1717
ansible_connection: ansible.netcommon.network_cli
18-
ansible_network_os: cisco.nxos.nxos
18+
ansible_network_os: cisco.nxos.nxos
1919
ansible_become: true
2020
ansible_become_method: enable
2121
children:

playbooks/roles/dcnm_bootflash/dcnm_tests.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
# Modify the hosts and vars sections with details for your testing
88
# setup and uncomment the testcase you want to run.
99
#
10-
- hosts: dcnm
11-
gather_facts: no
10+
- name: Play for dcnm
11+
hosts: dcnm
12+
gather_facts: false
1213
connection: ansible.netcommon.httpapi
1314

1415
vars:
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
nxos_vars:
2-
switch1_file1: air.ndfc_ut
3-
switch1_file2: earth.ndfc_ut
4-
switch1_file3: fire.ndfc_ut
5-
switch1_file4: water.ndfc_ut
6-
switch2_file1: black.ndfc_ut
7-
switch2_file2: blue.ndfc_ut
8-
switch2_file3: green.ndfc_ut
9-
switch2_file4: red.ndfc_ut
2+
switch1_file1: air.ndfc_ut
3+
switch1_file2: earth.ndfc_ut
4+
switch1_file3: fire.ndfc_ut
5+
switch1_file4: water.ndfc_ut
6+
switch2_file1: black.ndfc_ut
7+
switch2_file2: blue.ndfc_ut
8+
switch2_file3: green.ndfc_ut
9+
switch2_file4: red.ndfc_ut

0 commit comments

Comments
 (0)