Repair an installed Linux lifecycle when rerunning its HTTPS installer

This commit is contained in:
2026-11-17 16:22:17 +01:00
parent fbd24b6d75
commit 95aa70766b
2 changed files with 12 additions and 0 deletions
+8
View File
@@ -280,6 +280,14 @@ def install(base, token_file):
remote((base, token), '/agent/v1/bootstrap/current?platform=' + PLATFORM, metadata)
require(read(metadata)['tenant_id'] == config['tenant'], 'different enrollment tenant')
save_token(ROOT, token, pwd.getpwnam('rmm-discovery').pw_gid)
# An operator rerunning the HTTPS installer can update the lifecycle
# harness without replacing the device identity or its stable verifier.
with (ROOT / 'release.lock').open('rb') as lock:
fcntl.flock(lock, fcntl.LOCK_EX)
harness = ROOT / 'lifecycle.py'
current = Path(__file__).read_bytes()
if harness.read_bytes() != current:
save(harness, current)
enable()
require(healthy(read(ROOT / 'current/manifest.json')['version'], 0), 'awaiting authenticated device heartbeat')
service('enable', '--now', TIMER)