test: close bound APT partial outcome through native signed sync
Rust development slice / linux (push) Failing after 6s
Rust development slice / linux (push) Failing after 6s
This commit is contained in:
@@ -134,10 +134,21 @@ def installation_status(payload):
|
||||
services={name:subprocess.run(['systemctl','show',name,'-p','ActiveState','--value'],capture_output=True).stdout.strip().decode()
|
||||
for name in ('rmm-agent-remote.service','rmm-helper-cloud.service','rmm-apt-helper.service')}
|
||||
hashes={name:hashlib.sha256(Path(name).read_bytes()).hexdigest() for name in
|
||||
('/usr/local/libexec/rmm-privileged-helper','/usr/lib/rmm-apt-transaction/apt_transaction.py')}
|
||||
('/usr/local/libexec/rmm-agent-remote','/usr/local/libexec/rmm-privileged-helper','/usr/lib/rmm-apt-transaction/apt_transaction.py')}
|
||||
return dict(reports=reports,services=services,hashes=hashes)
|
||||
|
||||
|
||||
def record_agent_upgrade(report,installed):
|
||||
m=cloud.contract;path=cloud.ROOT/'devstate/remote-vm.json'
|
||||
require(report['completed'] and report['preserved_state'] and not report['apt_endpoint_enabled'],'qualified preserving installation')
|
||||
require(m.protected_json(path)==installed,'local deployment record drift')
|
||||
ident=Path(report['backup']).name
|
||||
m.write_private(STATE/(ident+'-agent-before.json'),installed)
|
||||
next_path=STATE/(ident+'-agent-next.json')
|
||||
m.write_private(next_path,dict(installed,binary_sha256=report['agent_sha256']))
|
||||
os.replace(next_path,path)
|
||||
|
||||
|
||||
def main():
|
||||
m=cloud.contract;os.umask(0o077);STATE.mkdir(mode=0o700,exist_ok=True)
|
||||
checkpoint=m.protected_json(apt.STATE/'apt_install_retry/checkpoint.json');grant=checkpoint['result']['result']['grant_id']
|
||||
@@ -155,7 +166,7 @@ def main():
|
||||
helper_sha256=hashlib.sha256(raw).hexdigest(),provider_sha256=hashlib.sha256(code).hexdigest())
|
||||
report=cloud.bootstrap.rpc('linux-vm.conf',upgrade,payload);m.write_private(STATE/('install-'+ident+'.json'),report)
|
||||
require(report['completed'] and report['agent_sha256']==payload['agent_sha256'],'qualified preserving installation')
|
||||
m.write_private(cloud.ROOT/'devstate/remote-vm.json',dict(installed,binary_sha256=report['agent_sha256']))
|
||||
record_agent_upgrade(report,installed)
|
||||
print({k:report[k] for k in ('completed','stage','preserved_state','package_effects','apt_endpoint_enabled')})
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user