Promote develop to main - #104
Merged
Merged
Conversation
…ut branch
The non-RawOutput path built $ObjectFinal from $Object, but $Object was
hardcoded to $null and never assigned, so every default (non-RawOutput) call
silently returned an empty array regardless of whether gravity actually
updated - there was no way to tell success from failure without RawOutput.
The gravity endpoint streams back the pihole -g console log as plain text,
not JSON, so there's no structured field to build a rich object from. The
formatted output now returns {Status = "Completed"} to match the same
pattern already used by Invoke-PiHoleFlushNetwork/Restart-PiHoleDnsService.
Also:
- Fixed a bug where -WhatIf (ShouldProcess declining) would still try to
read $Response, which was never set in that case.
- Removed the stray break in the catch block (inconsistent with every other
function and would end the pipeline early on error).
- Added SYNOPSIS/DESCRIPTION/PARAMETER/EXAMPLE help matching module
convention, which also drops the README's WIP flag for this function.
- Added an integration test covering the formatted output, verified against
the real Pi-hole server (full gravity rebuild, ~80s runtime).
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Matches the other two tests in this file, which already print the result they assert on for easier debugging when a run fails. Co-Authored-By: Claude Sonnet 5 <[email protected]>
fix: make Update-PiHoleActionsGravity production ready
…DnsBlocking Both functions had a raw Pi-hole API docs URL sitting in .SYNOPSIS instead of an actual synopsis, which is why the README's command reference table showed "No description yet" for them. Replaced with real SYNOPSIS text and added a .DESCRIPTION block for each, matching the convention used elsewhere in the module, and regenerated the README. Co-Authored-By: Claude Sonnet 5 <[email protected]>
…gration tests
Add-PiHoleList and Remove-PiHoleList were both marked Work In Progress and,
per the live Pi-hole OpenAPI spec, functionally broken:
- Add-PiHoleList sent `type` in the JSON body, but POST /api/lists requires
it as a query parameter (?type=block|allow). Every call 400'd.
- Add-PiHoleList's DateUpdated calculation was hoisted outside its own
foreach loop, evaluating against an undefined $Item on every call.
- Remove-PiHoleList's formatted output tried to build objects from
$Response.lists, but a successful delete is HTTP 204 No Content - there's
no body to parse, so it always silently returned an empty array. Replaced
with a simple {Address, Type, Status} object, matching the pattern used by
Invoke-PiHoleFlushNetwork/Restart-PiHoleDnsService/Update-PiHoleActionsGravity
for actions with no meaningful response body.
- Remove-PiHoleList had a dead pre-check (looked up the list, then did
nothing with the result) and didn't mark Address/Type as mandatory.
Also fixed a shared bug in Request-PiHoleAuth (the internal auth helper
every function calls): its catch block had a stray `break`, and
[CmdletBinding()] was misplaced inside param() instead of above it. The
break meant any auth failure - even with -ErrorAction SilentlyContinue -
would silently abort the entire calling script/pipeline, not just the
function. This directly blocked writing correct "bad password" tests for
Add-PiHoleList (which calls Get-PiHoleList and Get-PiHoleGroup internally
to check for an existing list before adding), so the identical stray
`break` was also removed from those two functions. Both are direct,
unavoidable dependencies of Add-PiHoleList's own logic.
Verified against a real Pi-hole v6 server: full add/remove round trip,
duplicate-add rejection, RawOutput on both, and bad-password errors on
both, using https://blocklistproject.github.io/Lists/alt-version/ransomware-nl.txt
as the test list. Added dedicated integration test files for both functions.
README regenerated to drop the WIP flag now that both are functional.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
…t-tests fix: make Add-PiHoleList/Remove-PiHoleList production ready, add integration tests
docs: add descriptions for Get-PiHoleDnsBlockingStatus and Set-PiHoleDnsBlocking
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
Promotes the following merged PRs from
developtomain:Update-PiHoleActionsGravityproduction-ready fix (dead formatted-output branch, straybreak,-WhatIfbug, full help, WIP flag removed)Add-PiHoleList/Remove-PiHoleListproduction-ready fixes (wrongtypequery param, broken 204-response handling, sharedRequest-PiHoleAuth/Get-PiHoleList/Get-PiHoleGroupstraybreakfix) plus new integration testsTest plan
develop🤖 Generated with Claude Code