feat: failure output prints firewall-rule punch list#16
Merged
Conversation
For each failed probe, print the corresponding `allow tcp/<port> to <host>`
rule beneath the FAIL line. After the per-failure list, print a
deduplicated summary of every rule the customer needs to add. Host is
extracted with `.split('/') | first` so URLs with paths (e.g.
`googleapis.com/foo`) still produce a clean firewall rule.
Failure exit code is unchanged — the play still fails non-zero on any
miss so the weekly CI cron still opens issues as before.
Tested:
- Success path: 16 of 16 live URLs pass, all firewall-rule tasks skip,
exit 0.
- Failure path (synthetic): 3 failures across http+https and a path-
bearing URL — per-line rules render correctly, dedup summary lists 3
unique rules with correct port/host derivation, exit 2.
Refs #12.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #12.
The playbook exists to help a customer fix Azure firewall rules. Today the failure output tells them what failed but not what to do. This PR turns the failure path into an actionable punch list.
Before / after
Before (existing behavior):
After:
And at the end of the play:
How it works
scheme_to_portmap (http: 80,https: 443) drives the rule format.item.0.url.split('/') | firstso URLs with paths (e.g.googleapis.com/foo) still produce a clean rule.(host, port)— if the same host fails on both http and https, you get two rules (one per port), not one. Same scheme + same host = one rule.Test results
Tested locally on both paths:
playbooks/files/websites.yml)skipping; exit0-e @bad-websites.yml:nonexistent.invalidon both schemes +192.0.2.1/bad/path2Files
playbooks/main.yml— 4 task changes (extendedset_fact, restructured failure msg, new dedupset_fact, new summary debug)CHANGELOG.md— entry under[Unreleased] / ChangedTest plan
yamllintclean locallyansible-lintclean locally🤖 Generated with Claude Code