Skip to content

feat: show detailed NetworkManager connection diffs in check mode - #918

Merged
richm merged 3 commits into
linux-system-roles:mainfrom
pfeifferj:feat/network-check-mode-diff
Oct 1, 2026
Merged

richm merged 3 commits into
linux-system-roles:mainfrom
pfeifferj:feat/network-check-mode-diff

Conversation

@pfeifferj

@pfeifferj pfeifferj commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

Enhancement:
Add detailed NetworkManager connection diffs to the network role’s check-mode output.

Reason:
Reporting only “is-modified” does not provide enough detail for change control, especially across large deployments.

Result:
Check mode reports individual route, address, and DNS additions/removals, scalar changes with old and new values, and added/removed settings.

Issue Tracker Tickets (Jira or BZ if any):
https://redhat.atlassian.net/browse/NMT-2408

Summary by CodeRabbit

  • New Features
    • Check mode now shows proposed NetworkManager connection changes in ansible-playbook output, including added or removed settings and properties, collection changes, and old and new values. Secret values are redacted, and --diff is not required.
    • Previews leave the live connection unchanged; updates are applied only during a real run.
  • Documentation
    • Added Compatibility guidance describing check-mode output and secret redaction.

@github-actions

Copy link
Copy Markdown

CI tests do not run automatically on pull requests. A role repository
maintainer can start them by posting a /citest slash command in a
pull request comment.

See GitHub CI testing using /citest
for details.

Run every available CI workflow:

/citest all

Run the linting and other lightweight checks:

/citest linters

Run the integration tests (QEMU/container and Testing Farm):

/citest integration

Run one or more selected workflows by separating their names with spaces:

/citest ansible-lint
/citest ansible-lint markdownlint
Command Check name Description
/citest all All checks listed below Run every CI test available for this role
/citest linters Lint and lightweight checks Run ansible-lint, ansible-test, ansible-managed-var-comment, codespell, markdownlint, pr-title-lint, test_converting_readme, and codeql, python-unit-test, and shellcheck when those workflows exist
/citest integration QEMU/container and Testing Farm checks Run qemu-kvm-integration-tests and tft
/citest ansible-lint Ansible Lint / ansible_lint (<ansible-lint>, <ansible>, <python>) (pull_request) Lint Ansible content after converting the role to collection format
/citest ansible-managed-var-comment Check for ansible_managed variable use in comments / ansible_managed_var_comment (pull_request) Fail if ansible_managed is used in comments
/citest ansible-test Ansible Test / ansible_test (<ansible>, <python>) (pull_request) Run ansible-test sanity tests
/citest codespell Codespell / Check for spelling errors (pull_request) Check for spelling errors
/citest markdownlint Markdown Lint / markdownlint (pull_request) Lint Markdown files
/citest pr-title-lint PR Title Lint / commit-checks Check that the pull request title follows the required format
/citest qemu-kvm-integration-tests Test / scenario (<image>, <env>) (pull_request) Run role integration tests in QEMU VMs and containers
/citest test_converting_readme Test converting README.md to README.html / test_converting_readme (pull_request) Convert README.md to HTML
/citest tft <platform>|ansible-<version> Run integration tests in Testing Farm
/citest woke Woke / Detect non-inclusive language (pull_request) Detect non-inclusive language
/citest codeql CodeQL / Analyze (python) (pull_request) CodeQL security and quality analysis for Python
/citest python-unit-test Python Unit Tests / python (<python>, <os>) (pull_request) Run Python unit tests
/citest shellcheck ShellCheck / shellcheck (pull_request) Lint shell scripts

Post another /citest comment at any time to run another selection.

@coderabbitai

coderabbitai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: linux-system-roles/network/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: d4bdbc9f-7eb8-4e85-a18c-c2c4d9290a3c

📥 Commits

Reviewing files that changed from the base of the PR and between 1112e25 and a6b15bd.

📒 Files selected for processing (2)
  • library/network_connections.py
  • tests/unit/test_network_connections.py

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.


📝 Walkthrough

Walkthrough

NetworkManager check-mode output now reports connection property and collection differences, with secret values redacted. Unit tests and a provider playbook cover diff formatting, dry-run logging, and whether previewing changes alters the live profile.

Changes

NetworkManager check-mode connection diffs

Layer / File(s) Summary
Connection diff generation
library/network_connections.py, tests/unit/test_network_connections.py
NMUtil normalizes and compares profiles, formats property and collection differences, and redacts secrets. Unit tests cover settings, NetworkManager value types, ordering, and normalization.
Dry-run diff logging
library/network_connections.py, tests/unit/test_network_connections.py
Cmd_nm logs diff messages during dry runs and warns if diff generation fails. Command tests cover unchanged profiles and confirm that updates occur only during real runs.
Check-mode playbook validation
tests/ensure_provider_tests.py, tests/tests_check_mode_diff_nm.yml, tests/playbooks/tests_check_mode_diff.yml, README.md
The provider test checks reported changes, confirms that a preview leaves the live profile unchanged, and cleans up test resources. The README describes the check-mode output.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to a6b15

The check-mode diff is ordered correctly, and the provider test checks that previewing changes leaves the live connection unchanged. No identified issue prevents merging after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 2.27% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 44 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description Format ⚠️ Warning The PR description contains the required Enhancement:, Reason:, and Result: sections, plus the optional issue tracker section. It does not contain the required Signed-off-by: section with a na… Add a Signed-off-by: line with the contributor’s name and email address, created with git commit -s, then update the PR description if needed.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title follows Conventional Commits format with the valid type feat and clearly describes the main change: detailed NetworkManager connection diffs in check mode.
Description check ✅ Passed The description includes all required sections: Enhancement, Reason, Result, and Issue Tracker Tickets. It explains the purpose, expected behavior, and related ticket.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description Format

Explanation

The PR description contains the required Enhancement:, Reason:, and Result: sections, plus the optional issue tracker section. It does not contain the required Signed-off-by: section with a name and email address.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pfeifferj

Copy link
Copy Markdown
Collaborator Author

/citest all

1 similar comment
@pfeifferj

Copy link
Copy Markdown
Collaborator Author

/citest all

Report individual route, address and DNS changes, scalar old and new
values, and added or removed settings through the existing stderr logger.
Use libnm setting diffs with the same normalization and comparison flags
as connection comparison, while redacting credentials and private keys.

Signed-off-by: Josephine Pfeiffer <josie@redhat.com>
Exercise property diffs with real libnm objects, including populated
settings, route attributes, secret redaction and older libnm APIs.
Verify check-mode logging and that dry runs do not update connections.

Signed-off-by: Josephine Pfeiffer <josie@redhat.com>
Run the role through Ansible to verify detailed IPv4 and IPv6 diffs,
unchanged connections during check mode, and convergence after applying.
Check that the test profile and interface are removed during cleanup.

Signed-off-by: Josephine Pfeiffer <josie@redhat.com>
@pfeifferj
pfeifferj force-pushed the feat/network-check-mode-diff branch from 1112e25 to a6b15bd Compare September 25, 2026 13:51
@pfeifferj

Copy link
Copy Markdown
Collaborator Author

/citest all

@richm

richm commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

/citest tft

@richm
richm requested a review from spetrosi September 28, 2026 18:20
@richm

richm commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

lgtm - would like Sergei to take a look

@richm
richm merged commit 65e9c32 into linux-system-roles:main Oct 1, 2026
41 of 43 checks passed
@pfeifferj
pfeifferj deleted the feat/network-check-mode-diff branch October 1, 2026 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants