tcc: gate cltbld-TCC.db-dependent resources on a custom fact#1211
Open
rcurranmoz wants to merge 2 commits into
Open
tcc: gate cltbld-TCC.db-dependent resources on a custom fact#1211rcurranmoz wants to merge 2 commits into
rcurranmoz wants to merge 2 commits into
Conversation
Replaces the log-grep reboot trigger in run-puppet.sh with a proactive gate based on a new `cltbld_tcc_db_present` custom fact. The script in `modules/macos_run_puppet/files/run-puppet.sh` previously greps puppet's stdout for the literal string unable to open database "/Users/cltbld/.../TCC.db" and on match does `sudo shutdown -r now`. That string is Apple-controlled, fires mid-apply (so downstream resources never run in that pass), and can't tell "cltbld TCC.db not ready yet" from "cltbld TCC.db permanently broken" — same string, very different remediation. This commit: - Adds `cltbld_tcc_db_present` (Boolean) custom fact in modules/macos_tcc_perms/lib/facter/. Returns true iff /Users/cltbld/Library/Application Support/com.apple.TCC/TCC.db exists. - Gates `macos_tcc_perms::execute tcc perms script` on the fact. - Gates `macos_safaridriver::execute perms script` and `macos_safaridriver::execute enable remote automation script` on the same fact. Both write to or depend on cltbld's TCC.db. - Removes the log-grep block from run-puppet.sh — with the fact-gating in place, the resources are no-ops on first apply (before cltbld autologin), so the puppet error string never appears. - Adds a post-success check in run-puppet.sh: if cltbld's TCC.db is still missing after a successful apply, reboot once so cltbld autologs in. The next puppet apply (via either the bootstrap LaunchDaemon (#1206) or the regular at-boot LaunchDaemon) will see cltbld_tcc_db_present=true and apply the gated resources cleanly. Behavior on a fresh host now goes: 1. Apply: autologin set up, TCC resources skipped, no errors 2. Reboot triggered by post-success check 3. cltbld autologs in, TCC.db materializes 4. Next apply: TCC resources actually apply Fixes #1208 Co-Authored-By: Claude Opus 4.7 (1M context) <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
Fixes #1208.
Replaces the log-grep reboot trigger in
run-puppet.shwith a proactive fact-based gate.The bootstrap script currently does this:
```bash
if grep -q "unable to open database \"/Users/cltbld/.../TCC.db" "$TMP_LOG"; then
echo "Detected TCC.db issue. A reboot is required."
sudo shutdown -r now
exit 0
fi
```
That string is Apple-controlled (we'd silently lose the trigger if Apple rewords or localizes it), reboots mid-apply (so downstream resources never run in this pass), and can't distinguish "cltbld TCC.db not ready yet" from "cltbld TCC.db permanently broken" — same string, very different remediation.
Changes
Behavior on a fresh host
Test plan
Related
Pairs naturally with #1206 (reboot-survivable bootstrap LaunchDaemon) — together they eliminate the babysitter ssh pattern entirely.
🤖 Generated with Claude Code