Persist derived config unsets

This commit is contained in:
Nick Sweeting 2026-05-18 21:02:32 -07:00
parent 7528d1f68d
commit abdede3609
No known key found for this signature in database
3 changed files with 15 additions and 3 deletions

View File

@ -29,6 +29,10 @@ class MachineService(BaseService):
key = event.key.replace("config/", "", 1).strip()
if key:
config[key] = event.value
elif event.method == "unset":
key = event.key.replace("config/", "", 1).strip()
if key:
config.pop(key, None)
else:
return

View File

@ -466,6 +466,15 @@ def test_machine_service_persists_only_derived_config_events(tmp_path):
)
await derived_event.now()
await derived_event.event_results_list()
unset_event = bus.emit(
MachineEvent(
method="unset",
key="config/WGET_BINARY",
config_type="derived",
),
)
await unset_event.now()
await unset_event.event_results_list()
await bus.wait_until_idle()
finally:
await bus.destroy()
@ -474,7 +483,6 @@ def test_machine_service_persists_only_derived_config_events(tmp_path):
machine.refresh_from_db()
assert machine.config == {
"WGET_BINARY": str(wget_binary),
"ABX_INSTALL_CACHE": {"wget": "2026-03-24T00:00:00+00:00"},
}

View File

@ -80,8 +80,8 @@ dependencies = [
### Binary/Package Management
"abxbus>=2.5.4", # EventBus API
"abxpkg>=1.10.7", # for: detecting, versioning, and installing binaries via apt/brew/pip/npm
"abx-plugins>=1.10.69", # shared ArchiveBox plugin package with Chrome/Puppeteer dependency wiring
"abx-dl>=1.10.69", # shared ArchiveBox downloader package with blocking install preflight
"abx-plugins>=1.10.70", # shared ArchiveBox plugin package with Chrome/Puppeteer dependency wiring
"abx-dl>=1.10.70", # shared ArchiveBox downloader package with blocking install preflight
### UUID7 backport for Python <3.14
"uuid7>=0.1.0; python_version < '3.14'", # provides the uuid_extensions module on Python 3.13
]