Report why a server call failed everywhere, not just at task completion - #163
Merged
Conversation
fos#162 gave fog.imgcomplete and fog.nonimgcomplete a helper that tells a
transport failure, an HTTP error, an empty 2xx and a real answer apart. Every
other script that talks to the server still read `res=$(curl -Lks --data ...)`,
which collapses all four into one empty string -- so the same blank failure
fos#162 fixed at completion was still there at check-in, registration,
inventory, capone and the multicast capability probe.
postToServer is generalized to callServer <url> [data]: GET when no data is
given, POST when there is, since it is the same exchange either way. It returns
0 with a body, 1 when the call failed, and 2 when the server answered 2xx with
nothing -- three outcomes rather than two, because a few endpoints answer empty
on purpose and a caller must be able to tell that from a dead server. That is
what fog.man.reg's location and OU prompts need.
23 call sites across 12 scripts are converted. Genuine bugs found on the way:
fog.inventory printed "Done" after giving up on all eleven attempts.
fog.capone reported "Count not find" and blamed the image for what could be a
transport failure.
restoreLVMPartition's multicast capability probe told the operator their
server was too old to multicast LVM when the probe had never reached it --
a claim about the server's VERSION drawn from a dead network.
fog.man.reg's locationcheck/oucheck skipped their prompts silently when the
GET failed, so a host registered into no location with no sign anything
had gone wrong.
fog.checkin and fog.man.reg looped without reporting anything at all.
Also fixes a regression shipped in fos#162: `res=$(curl ...)` strips trailing
newlines and the helper did not, so a server whose reply ended in a newline
yielded "##\n", every `== "##"` comparison failed, and a capture that had
SUCCEEDED retried eleven times and gave up. Test 5b pins it -- and had to be
written twice, because the first cut read the body through `head -1`, which
cannot see a trailing newline and stayed green with the fix removed.
Left on raw curl deliberately, each with its reason at the call site:
fog.statusreporter (a 3s ping would paint over imaging output),
fog.av (fire-and-forget), reportToServer (its contract is silence, pinned by
tests/checks/error-report.sh), the secureboot-funcs.sh and bin/fog `-o`
downloads, and S40network's connectivity probe.
tests/checks/server-post-reporting.sh grows to 15 assertions: the GET/POST
split, the three return codes, and two whole-file sweeps -- no call site
anywhere in the overlay may wrap callServer in $( ), and raw curl may read a
reply only in the exceptions named above. tests/checks/lvm.sh gains case 30 for
the capability probe, and its curl stub now emits the -w status line it always
implied. Every new assertion was mutation-verified red before being kept.
Co-Authored-By: Claude <noreply@anthropic.com>
mastacontrola
force-pushed
the
curl-reporting-sweep
branch
from
August 26, 2026 17:35
ecfcfd7 to
6b5ea8d
Compare
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.
Follow-on to #162, which fixed the blank
* Error returned:at task completion. Every other script that talks to the FOG server still readres=$(curl -Lks --data ...), which collapses a connect failure, an HTTP error, an empty 2xx and a real answer into one empty string — so the same silence #162 fixed at completion was still there at check-in, registration, inventory, capone and the multicast capability probe.What changed
postToServeris generalized tocallServer <url> [data]— GET when no data is given, POST when there is, because it is the same exchange either way. It returns:Three outcomes rather than two, because a few endpoints answer empty on purpose and a caller has to be able to tell that from a dead server — which is exactly what
fog.man.reg's location and OU prompts need.23 call sites across 12 scripts converted.
Bugs found on the way
fog.inventoryprintedDoneafter giving up. All eleven attempts could fail and the operator was told it worked.fog.caponereportedCount not find(sic) and blamed the image for what may have been a transport failure.restoreLVMPartition's capability probe told the operator their server was too old to multicast LVM when the probe had never reached it — a claim about the server's version drawn from a dead network. Same shape as fogproject#1266.fog.man.reg'slocationcheck/oucheckskipped their prompts silently on a failed GET, so a host registered into no location with nothing on screen to say so.fog.checkinandfog.man.reglooped without reporting anything at all.Regression fixed from #162
res=$(curl ...)strips trailing newlines; the helper did not. A server whose reply ended in a newline yielded##\n, every== "##"comparison failed, and a capture that had succeeded retried eleven times and then gave up. Case 5b pins it — and had to be written twice: the first cut read the body throughhead -1, which cannot see a trailing newline, and stayed green with the fix removed.Left on raw curl deliberately
Each with its reason in a comment at the call site:
fog.statusreporter(a 3s ping would paint over imaging output),fog.av(fire-and-forget),reportToServer(its contract is silence — pinned bytests/checks/error-report.sh), thesecureboot-funcs.shandbin/fog-odownloads, andS40network's connectivity probe.Tests
tests/checks/server-post-reporting.sh→ 15 assertions, adding the GET/POST split, the three return codes, and two whole-overlay sweeps: no call site may wrapcallServerin$( )(the subshell discards every variable it set — the bug this file exists to prevent), and raw curl may read a reply only in the exceptions listed above.tests/checks/lvm.sh→ case 30 for an unreachable capability probe, and its curl stub now emits the-wstatus line it always implied.Every new assertion was mutation-verified red before being kept:
--data$( )$( )Full suite: 15 check scripts pass, golden output byte-identical.