feat: qualify bound configure-only recovery runtime on cloud VM
Rust development slice / linux (push) Failing after 6s
Rust development slice / linux (push) Failing after 6s
This commit is contained in:
@@ -186,21 +186,32 @@ def validate_apt_manifest(value):
|
||||
"""Pure format verification, NEVER evidence that live planning/acceptance ran."""
|
||||
fields = {'type', 'schema_version', 'action', 'execution_profile', 'transaction_sha256', 'resolved_apt_transaction',
|
||||
'transaction_bytes', 'provider_sha256', 'hook_sha256', 'apt_config_sha256', 'runtime_sha256', 'test_result_id'}
|
||||
require(set(value) == fields and value['type'] == 'rmm.apt.helper-action' and value['schema_version'] == 2
|
||||
recovery=value.get('schema_version')==4
|
||||
if recovery:fields.add('native_recovery')
|
||||
require(set(value) == fields and value['type'] == 'rmm.apt.helper-action' and value['schema_version'] in (2,4)
|
||||
and value['action'] in ('apt-native-acceptance', 'apt-execute') and value['execution_profile'] == 'dev-test', 'apt_manifest_schema')
|
||||
if recovery:
|
||||
reference=value['native_recovery']
|
||||
require(value['action']=='apt-native-acceptance' and set(reference)=={'schema_version','previous_grant_id','previous_attempt_id','partial_proof_sha256'}
|
||||
and reference['schema_version']==1 and all(str(uuid.UUID(reference[k]))==reference[k] and uuid.UUID(reference[k]).int!=0
|
||||
for k in ('previous_grant_id','previous_attempt_id')) and re.fullmatch('[a-f0-9]{64}',reference['partial_proof_sha256']),
|
||||
'typed native recovery reference')
|
||||
raw = value['transaction_bytes']
|
||||
require(isinstance(raw, list) and len(raw) <= 65536 and all(type(n) is int and 0 <= n < 256 for n in raw), 'apt_exact_transaction_bytes')
|
||||
raw = bytes(raw)
|
||||
require(hashlib.sha256(raw).hexdigest() == value['transaction_sha256'], 'apt_transaction_hash')
|
||||
transaction = json.loads(raw, object_pairs_hook=strict_object)
|
||||
require(transaction == value['resolved_apt_transaction'] and set(transaction) == {'schema_version', 'recipe_id', 'recipe_version', 'platform',
|
||||
'resolver_config_version', 'no_reboot', 'status_fingerprint', 'baseline_sha256', 'packages'}, 'apt_full_typed_transaction')
|
||||
require(type(transaction['schema_version']) is int and transaction['schema_version'] == 1 and transaction['recipe_version'] == '1' and transaction['platform'] == 'ubuntu-24.04-amd64'
|
||||
txfields={'schema_version','recipe_id','recipe_version','platform','resolver_config_version','no_reboot','status_fingerprint','baseline_sha256','packages'}
|
||||
if recovery:txfields.add('operation')
|
||||
require(transaction == value['resolved_apt_transaction'] and set(transaction) == txfields, 'apt_full_typed_transaction')
|
||||
require(type(transaction['schema_version']) is int and transaction['schema_version'] == (2 if recovery else 1) and transaction['recipe_version'] == '1' and transaction['platform'] == 'ubuntu-24.04-amd64'
|
||||
and transaction['resolver_config_version'] == 'rmm-apt-local-v1' and transaction['no_reboot'] is True, 'apt_fixture_profile_no_reboot')
|
||||
if recovery:require(transaction['operation']=='configure_only' and transaction['recipe_id']=='rmm-apt-fixture-install-1.0','same fixture configure-only mode')
|
||||
pins = {'rmm-apt-fixture-install-1.0': (None, '1.0', '74036ae81223deab3aae994fd2a2a695af408741777e1ce17dcb4e32f1235867'),
|
||||
'rmm-apt-fixture-update-1.1': ('1.0', '1.1', 'ef67c9fe0ba1443fcfe465768e1204763063c369a2a1da04af6027d8a9c00491')}
|
||||
require(transaction['recipe_id'] in pins and len(transaction['packages']) == 1, 'apt_fixed_single_package_recipe')
|
||||
old, new, pin = pins[transaction['recipe_id']]
|
||||
if recovery:old='1.0'
|
||||
package = transaction['packages'][0]
|
||||
require(package == dict(name='rmm-mvp-test', architecture='all', old_version=old, new_version=new, origin='rmm-test',
|
||||
sha256=pin, size=20672, archive_path='/var/lib/rmm-apt-transaction/archives/' + pin + '.deb'), 'apt_pinned_fixture_archive')
|
||||
|
||||
Reference in New Issue
Block a user