mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-29 22:37:29 +00:00
fix(applications_carrier): overwrite a carrier left in the fact cache on clear
The fact cache merges the cacheable fact layer, so the empty mapping that clear registered there left an older fact-parked carrier in ansible_facts, where get_vars kept deep-copying it before every task. clear now writes None for every carrier key it finds in ansible_facts, which is the recovery the reader's CarrierInvisibleError message points to. The integration test parks the carrier as a fact, clears it and parks it again, with fact injection on and off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0c0f2d4c73
commit
cb6fa4b6bc
3 files changed
+74
-11
No files matched your search
@@ -277,6 +277,29 @@ class TestApplicationsCarrierActionPlugin(unittest.TestCase):
|
||||
self.assertEqual(applications.calls, [])
|
||||
self.assertEqual(users.calls, [])
|
||||
|
||||
def test_clear_overwrites_a_carrier_left_in_the_fact_cache(self):
|
||||
action = _make_action(_FakeTask(args={"clear": True}))
|
||||
stale = {"key": ["roles", ["a"]], "applications": {"x": {}}}
|
||||
with patch(
|
||||
"plugins.action.applications_carrier.ActionBase.run",
|
||||
autospec=True,
|
||||
return_value={},
|
||||
):
|
||||
action.run(
|
||||
task_vars={
|
||||
"ansible_facts": {
|
||||
APPLICATIONS_RENDERED_FACT: stale,
|
||||
"os_family": "Debian",
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
action.registered[VariableLayer.CACHEABLE_FACT],
|
||||
{APPLICATIONS_RENDERED_FACT: None},
|
||||
)
|
||||
self.assertIsNone(_parked(action)[APPLICATIONS_RENDERED_FACT])
|
||||
|
||||
def test_clear_false_still_renders(self):
|
||||
applications, users, loader = _lookups()
|
||||
action = _make_action(_FakeTask(args={"clear": "no"}))
|
||||
|
||||
Reference in new issue
Block a user