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:
@@ -196,16 +196,19 @@ class PackageArchive:
|
||||
archive_path: str
|
||||
|
||||
@classmethod
|
||||
def parse(cls, obj):
|
||||
def parse(cls, obj, configure_only=False):
|
||||
exact(obj, 'name architecture old_version new_version origin sha256 size archive_path')
|
||||
token(obj['name'], NAME, 'PACKAGE_NAME')
|
||||
require(not FORBIDDEN.match(obj['name']), 'PROTECTED_PACKAGE')
|
||||
require(obj['architecture'] in ('amd64', 'all'), 'ARCHITECTURE')
|
||||
token(obj['new_version'], VERSION, 'VERSION')
|
||||
if configure_only:
|
||||
require(obj['old_version'] == obj['new_version'] == '1.0', 'RECOVERY_VERSION')
|
||||
if obj['old_version'] is not None:
|
||||
token(obj['old_version'], VERSION, 'VERSION')
|
||||
# Debian ordering, not lexical/semver ordering. Read-only argv.
|
||||
require(subprocess.run(['/usr/bin/dpkg', '--compare-versions', obj['old_version'],
|
||||
require((obj['old_version'] == obj['new_version'] == '1.0') if configure_only else
|
||||
subprocess.run(['/usr/bin/dpkg', '--compare-versions', obj['old_version'],
|
||||
'lt', obj['new_version']], env=ENV,
|
||||
stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL).returncode == 0,
|
||||
@@ -229,12 +232,16 @@ class ResolvedAptTransaction:
|
||||
status_fingerprint: str
|
||||
baseline_sha256: str
|
||||
packages: Tuple[PackageArchive, ...]
|
||||
operation: Optional[str] = None
|
||||
|
||||
@classmethod
|
||||
def parse(cls, obj):
|
||||
version = obj.get('schema_version') if type(obj) is dict else None
|
||||
exact(obj, 'schema_version recipe_id recipe_version platform resolver_config_version '
|
||||
'no_reboot status_fingerprint baseline_sha256 packages')
|
||||
require(type(obj['schema_version']) is int and obj['schema_version'] == 1, 'SCHEMA_VERSION')
|
||||
'no_reboot status_fingerprint baseline_sha256 packages' + (' operation' if version == 2 else ''))
|
||||
require(type(version) is int and version in (1, 2), 'SCHEMA_VERSION')
|
||||
configure_only = version == 2
|
||||
require(not configure_only or obj['operation'] == 'configure_only', 'TRANSACTION_OPERATION')
|
||||
token(obj['recipe_id'], IDENT, 'RECIPE_ID')
|
||||
token(obj['recipe_version'], IDENT, 'RECIPE_VERSION')
|
||||
require(obj['platform'] == 'ubuntu-24.04-amd64', 'UNSUPPORTED_PLATFORM')
|
||||
@@ -244,9 +251,12 @@ class ResolvedAptTransaction:
|
||||
token(obj['baseline_sha256'], HASH, 'FINGERPRINT')
|
||||
require(type(obj['packages']) is list and 0 < len(obj['packages']) <= MAX_PACKAGES,
|
||||
'PACKAGE_COUNT')
|
||||
packages = tuple(PackageArchive.parse(p) for p in obj['packages'])
|
||||
packages = tuple(PackageArchive.parse(p, configure_only=configure_only) for p in obj['packages'])
|
||||
require(len({(p.name, p.architecture) for p in packages}) == len(packages), 'DUPLICATE_PACKAGE')
|
||||
return cls(**{**obj, 'packages': packages})
|
||||
transaction = cls(**{**obj, 'packages': packages})
|
||||
if configure_only:
|
||||
fixture_scope(transaction)
|
||||
return transaction
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@@ -336,6 +346,10 @@ def fixture_scope(transaction):
|
||||
'FIXTURE_RECIPE')
|
||||
require(len(transaction.packages) == 1, 'FIXTURE_CLOSURE')
|
||||
old, new = FIXTURE_RECIPES[transaction.recipe_id]
|
||||
if transaction.operation == 'configure_only':
|
||||
require(transaction.schema_version == 2 and transaction.recipe_id == 'rmm-apt-fixture-install-1.0',
|
||||
'RECOVERY_FIXED_RECIPE')
|
||||
old = new = '1.0'
|
||||
package = transaction.packages[0]
|
||||
require(package.name == 'rmm-mvp-test' and package.architecture == 'all' and
|
||||
package.origin == 'rmm-test' and package.old_version == old and package.new_version == new,
|
||||
@@ -370,14 +384,20 @@ def load_signed_action(transaction, context):
|
||||
manifest_keys += ('resolved_apt_transaction provider_sha256 hook_sha256 apt_config_sha256 '
|
||||
'runtime_sha256 test_result_id transaction_bytes')
|
||||
version = action.get('schema_version') if type(action) is dict else None
|
||||
exact(action, manifest_keys + (' native_retry' if version == 3 else ''))
|
||||
exact(action, manifest_keys + (' native_retry' if version == 3 else ' native_recovery' if version == 4 else ''))
|
||||
require(action['type'] == 'rmm.apt.helper-action' and
|
||||
type(version) is int and version in (2, 3),
|
||||
type(version) is int and version in (2, 3, 4),
|
||||
'SIGNED_ACTION_SCHEMA')
|
||||
if version == 3:
|
||||
validate_retry_reference(action['native_retry'])
|
||||
require(context.action == 'apt-native-acceptance' and context.execution_profile == 'dev-test',
|
||||
'RETRY_NATIVE_TEST_ONLY')
|
||||
if version == 4:
|
||||
validate_recovery_reference(action['native_recovery'])
|
||||
require(context.action == 'apt-native-acceptance' and context.execution_profile == 'dev-test' and
|
||||
transaction.operation == 'configure_only', 'RECOVERY_NATIVE_CONFIGURE_ONLY')
|
||||
else:
|
||||
require(transaction.operation is None, 'RECOVERY_MANIFEST_REQUIRED')
|
||||
expected_bytes = sealed_read(ACTIVE / 'expectation.json')
|
||||
require(type(action['transaction_bytes']) is list and len(action['transaction_bytes']) <= 65536 and
|
||||
all(type(value) is int and 0 <= value <= 255 for value in action['transaction_bytes']) and
|
||||
@@ -418,6 +438,11 @@ def check_native_gate(transaction, context, action, runtime, native_acceptance):
|
||||
'DEDICATED_HELPER_ACTION_REQUIRED')
|
||||
path = record_path(transaction)
|
||||
if native_acceptance:
|
||||
if action.get('native_recovery') is not None:
|
||||
verify_recovery_reference(transaction, context, action)
|
||||
require(not os.path.lexists(BASE / ('recovery-' + action['native_recovery']['previous_grant_id'] + '.json')),
|
||||
'RECOVERY_ALREADY_RECORDED')
|
||||
return
|
||||
require(not path.exists(), 'ACCEPTANCE_ALREADY_RECORDED')
|
||||
return
|
||||
proof = json_bytes(sealed_read(path))
|
||||
@@ -486,6 +511,92 @@ def validate_retry_reference(ref):
|
||||
token(ref['bootstrap_marker_sha256'], HASH, 'RETRY_MARKER_HASH')
|
||||
|
||||
|
||||
def validate_recovery_reference(ref):
|
||||
exact(ref, 'schema_version previous_grant_id previous_attempt_id partial_proof_sha256')
|
||||
require(type(ref['schema_version']) is int and ref['schema_version'] == 1, 'RECOVERY_SCHEMA')
|
||||
for key in ('previous_grant_id', 'previous_attempt_id'):
|
||||
value = ref[key]
|
||||
require(type(value) is str and str(uuid.UUID(value)) == value and uuid.UUID(value).int != 0,
|
||||
'RECOVERY_ID')
|
||||
token(ref['partial_proof_sha256'], HASH, 'RECOVERY_PROOF_HASH')
|
||||
|
||||
|
||||
def validate_partial_proof(proof):
|
||||
exact(proof, 'schema_version type transaction_sha256 job_payload_sha256 effect_armed_ledger_id '
|
||||
'grant_id job_id attempt_id authorization_id plan_sha256 original_evidence_sha256 '
|
||||
'original_baseline_sha256 observed_snapshot_sha256 status_fingerprint fixture_payload_sha256 '
|
||||
'snapshot checked_at_ms partial_effect postconditions_passed reboot_required')
|
||||
require(type(proof['schema_version']) is int and proof['schema_version'] == 1 and
|
||||
proof['type'] == 'rmm.apt.partial-reconciliation' and proof['partial_effect'] is True and
|
||||
proof['postconditions_passed'] is False and proof['reboot_required'] is False and
|
||||
type(proof['checked_at_ms']) is int and proof['checked_at_ms'] > 0, 'RECOVERY_PROOF_TYPE')
|
||||
for key in ('transaction_sha256', 'job_payload_sha256', 'plan_sha256', 'original_evidence_sha256',
|
||||
'original_baseline_sha256', 'observed_snapshot_sha256', 'status_fingerprint', 'fixture_payload_sha256'):
|
||||
token(proof[key], HASH, 'RECOVERY_PROOF_HASH')
|
||||
for key in ('grant_id','job_id','attempt_id','authorization_id'):
|
||||
value = proof[key]
|
||||
require(type(value) is str and str(uuid.UUID(value)) == value and uuid.UUID(value).int != 0,
|
||||
'RECOVERY_PROOF_ID')
|
||||
token(proof['effect_armed_ledger_id'], IDENT, 'RECOVERY_PROOF_LEDGER')
|
||||
require(type(proof['snapshot']) is dict and
|
||||
digest(canonical(proof['snapshot'])) == proof['observed_snapshot_sha256'] and
|
||||
proof['snapshot'].get('rmm-mvp-test:all') == {'version':'1.0','status':'install ok unpacked'} and
|
||||
proof['fixture_payload_sha256'] == digest(b'1.0\n'), 'RECOVERY_PROOF_SNAPSHOT')
|
||||
|
||||
|
||||
def verify_recovery_reference(transaction, context, action):
|
||||
"""Only immutable linkage here; current state is checked before the hook.
|
||||
|
||||
RootHelper additionally requires this proof in its original shared SQLite
|
||||
ledger with terminal classified failure and the original verified Request.
|
||||
Caller-provided JSON or a root-owned file alone never grants authority.
|
||||
"""
|
||||
ref = action['native_recovery']; validate_recovery_reference(ref)
|
||||
require(context.action == 'apt-native-acceptance' and context.execution_profile == 'dev-test' and
|
||||
action['schema_version'] == 4 and transaction.schema_version == 2 and
|
||||
transaction.operation == 'configure_only', 'RECOVERY_DEDICATED_ACTION')
|
||||
fixture_scope(transaction)
|
||||
raw_proof = sealed_read(ACTIVE / 'partial-proof.json')
|
||||
proof = json_bytes(raw_proof); validate_partial_proof(proof)
|
||||
require(raw_proof == canonical(proof) and digest(raw_proof) == ref['partial_proof_sha256'] and
|
||||
proof['grant_id'] == ref['previous_grant_id'] and proof['attempt_id'] == ref['previous_attempt_id'],
|
||||
'RECOVERY_IMMUTABLE_PROOF_BINDING')
|
||||
require(context.grant_id != proof['grant_id'] and context.attempt_id != proof['attempt_id'] and
|
||||
context.job_id != proof['job_id'] and context.authorization_id != proof['authorization_id'] and
|
||||
context.plan_sha256 != proof['plan_sha256'], 'RECOVERY_NEW_APPROVAL_REQUIRED')
|
||||
require(transaction.baseline_sha256 == proof['observed_snapshot_sha256'] and
|
||||
transaction.status_fingerprint == proof['status_fingerprint'] and
|
||||
sealed_read(ACTIVE / 'baseline.json') == canonical(proof['snapshot']), 'RECOVERY_BASELINE_BINDING')
|
||||
previous = BASE / 'history' / ref['previous_grant_id']
|
||||
secure_path(previous, directory=True, private=True)
|
||||
names = ('context.json','signed-action.json','expectation.json','baseline.json','launch.json',
|
||||
'native-prechecks.json','sandbox-ready.json','sandbox-result.json','hook-armed.json')
|
||||
historical = {name: sealed_read(previous / name) for name in names}
|
||||
for prefix in ('bootstrap-attempt-', 'bootstrap-retry-'):
|
||||
name = prefix + 'rmm-apt-fixture-install-1.0.json'
|
||||
historical[name] = sealed_read(BASE / name)
|
||||
require(digest(canonical({name:digest(raw) for name,raw in historical.items()})) ==
|
||||
proof['original_evidence_sha256'], 'RECOVERY_HISTORY_CHANGED')
|
||||
old = VerifiedHelperContext.parse(json_bytes(historical['context.json']))
|
||||
require(all(getattr(old, key) == proof[key] for key in
|
||||
('transaction_sha256','job_payload_sha256','effect_armed_ledger_id','grant_id',
|
||||
'job_id','attempt_id','authorization_id','plan_sha256')) and
|
||||
digest(historical['signed-action.json']) == proof['job_payload_sha256'] and
|
||||
digest(historical['expectation.json']) == proof['transaction_sha256'] and
|
||||
digest(historical['baseline.json']) == proof['original_baseline_sha256'],
|
||||
'RECOVERY_ORIGINAL_CONTEXT_BINDING')
|
||||
old_job = json_bytes(historical['signed-action.json'])
|
||||
new_job = json_bytes(sealed_read(ACTIVE / 'signed-action.json'))
|
||||
require(all(old_job[key] == new_job[key] for key in
|
||||
('tenant_id','asset_id','agent_id','enrollment_generation','assignment_version')) and
|
||||
digest(sealed_read(previous / 'apt.conf')) == old_job['action']['apt_manifest']['apt_config_sha256'],
|
||||
'RECOVERY_ORIGINAL_TARGET_OR_CONFIG')
|
||||
require(not os.path.lexists(BASE / 'acceptance-rmm-apt-fixture-install-1.0.json') and
|
||||
not os.path.lexists(BASE / 'pending-acceptance-rmm-apt-fixture-install-1.0.json'),
|
||||
'RECOVERY_NOT_INSTALL_ACCEPTANCE')
|
||||
return proof
|
||||
|
||||
|
||||
def historical_retry_evidence(transaction, context, action):
|
||||
"""Recheck immutable no-handoff evidence, never turn unknown into failed.
|
||||
|
||||
@@ -549,6 +660,10 @@ def historical_retry_evidence(transaction, context, action):
|
||||
|
||||
def bootstrap_binding(transaction, context, action):
|
||||
binding = attempt_binding(context)
|
||||
if action.get('native_recovery') is not None:
|
||||
verify_recovery_reference(transaction, context, action)
|
||||
binding.update(native_recovery=action['native_recovery'])
|
||||
return BASE / ('recovery-attempt-' + action['native_recovery']['previous_grant_id'] + '.json'), binding
|
||||
if action.get('native_retry') is not None:
|
||||
binding.update(native_retry=action['native_retry'], previous_evidence_sha256=
|
||||
historical_retry_evidence(transaction, context, action))
|
||||
@@ -664,8 +779,16 @@ def complete_acceptance(transaction, context, action, runtime, evidence):
|
||||
'completed_at_ms': time.time_ns() // 1000000}
|
||||
# Stage+fsync complete bytes before publishing. Failed writes never leave a
|
||||
# parseable final partial record. An existing final record is never replaced.
|
||||
path = record_path(transaction)
|
||||
staged = BASE / ('pending-acceptance-' + transaction.recipe_id + '.json')
|
||||
recovery = action.get('native_recovery')
|
||||
if recovery is not None:
|
||||
verify_recovery_reference(transaction, context, action)
|
||||
proof.update(schema_version=1, type='rmm.apt.native-recovery', operation='configure_only',
|
||||
native_recovery=recovery)
|
||||
path = BASE / ('recovery-' + recovery['previous_grant_id'] + '.json')
|
||||
staged = BASE / ('pending-recovery-' + recovery['previous_grant_id'] + '.json')
|
||||
else:
|
||||
path = record_path(transaction)
|
||||
staged = BASE / ('pending-acceptance-' + transaction.recipe_id + '.json')
|
||||
durable_once(staged, proof)
|
||||
linked = False
|
||||
try:
|
||||
@@ -681,6 +804,11 @@ def complete_acceptance(transaction, context, action, runtime, evidence):
|
||||
path.unlink()
|
||||
raise
|
||||
# Retain staged bytes as an immutable record witness; never reset attempts.
|
||||
if recovery is not None:
|
||||
return {'test_acceptance': True, 'noProductionEvidence': True, 'native_recovery': True,
|
||||
'recovery_record_sha256': digest(canonical(proof)),
|
||||
'partial_proof_sha256': recovery['partial_proof_sha256'],
|
||||
'test_result_id': action['test_result_id']}
|
||||
return {'test_acceptance': True, 'noProductionEvidence': True,
|
||||
'native_record_sha256': digest(canonical(proof)), 'test_result_id': action['test_result_id']}
|
||||
|
||||
@@ -747,6 +875,12 @@ def parse_protocol3(data):
|
||||
|
||||
|
||||
def validate_actions(transaction, actions):
|
||||
if transaction.operation == 'configure_only':
|
||||
fixture_scope(transaction)
|
||||
require(len(actions) == 1 and actions[0] == Action(
|
||||
'rmm-mvp-test', '1.0', 'all', 'none', '=', '1.0', 'all', 'none', '**CONFIGURE**'),
|
||||
'RECOVERY_CONFIGURE_ACTION_ONLY')
|
||||
return
|
||||
expected = {(p.name, p.architecture): p for p in transaction.packages}
|
||||
seen = set()
|
||||
for action in actions:
|
||||
@@ -876,7 +1010,13 @@ def installed_snapshot():
|
||||
def check_current_baseline(transaction, baseline):
|
||||
require(digest(canonical(baseline)) == transaction.baseline_sha256, 'BASELINE_HASH')
|
||||
require(status_fingerprint() == transaction.status_fingerprint, 'STATUS_FINGERPRINT')
|
||||
require(installed_snapshot() == baseline, 'STATUS_BASELINE_CHANGED')
|
||||
snapshot = partial_installed_snapshot() if transaction.operation == 'configure_only' else installed_snapshot()
|
||||
require(snapshot == baseline, 'STATUS_BASELINE_CHANGED')
|
||||
if transaction.operation == 'configure_only':
|
||||
fixture_scope(transaction)
|
||||
require(baseline.get('rmm-mvp-test:all') == {'version': '1.0', 'status': 'install ok unpacked'} and
|
||||
sealed_read(Path('/usr/share/rmm-mvp-test/version'), limit=32) == b'1.0\n',
|
||||
'RECOVERY_PARTIAL_PRECONDITION')
|
||||
|
||||
|
||||
def check_preconditions(transaction, baseline):
|
||||
@@ -884,7 +1024,8 @@ def check_preconditions(transaction, baseline):
|
||||
for p in transaction.packages:
|
||||
current = baseline.get(p.name + ':' + p.architecture)
|
||||
require((current is None if p.old_version is None else
|
||||
current == {'version': p.old_version, 'status': 'install ok installed'}),
|
||||
current == {'version': p.old_version, 'status':
|
||||
'install ok unpacked' if transaction.operation == 'configure_only' else 'install ok installed'}),
|
||||
'PACKAGE_PRECONDITION')
|
||||
|
||||
|
||||
@@ -933,6 +1074,10 @@ DPkg::Tools::Options::/usr/lib/rmm-apt-transaction/hook::InfoFD "0";
|
||||
|
||||
|
||||
def apt_argv(transaction):
|
||||
if transaction.operation == 'configure_only':
|
||||
fixture_scope(transaction)
|
||||
return ['/usr/bin/apt-get', '--yes', '--no-remove', '--no-install-recommends',
|
||||
'install', '--', 'rmm-mvp-test=1.0']
|
||||
# APT's --no-download also prevents the local file method from resolving
|
||||
# its Install filename (v3 emits **ERROR**). Permit local acquisition of
|
||||
# the already sealed/hash-checked archive. Empty sources, fixed paths and
|
||||
@@ -1445,7 +1590,10 @@ def execute(request, native_acceptance=False):
|
||||
check_current_baseline(transaction, baseline)
|
||||
for package in transaction.packages:
|
||||
verify_archive(package)
|
||||
require(run_read(['/usr/bin/dpkg', '--audit']) == b'', 'DPKG_AUDIT')
|
||||
# The exact bound unpacked fixture is the declared recovery input;
|
||||
# ordinary jobs continue to require a clean audit before mutation.
|
||||
if transaction.operation != 'configure_only':
|
||||
require(run_read(['/usr/bin/dpkg', '--audit']) == b'', 'DPKG_AUDIT')
|
||||
context.check_deadline()
|
||||
if not native_acceptance:
|
||||
evidence = verified_no_change(transaction, baseline, context)
|
||||
@@ -1475,7 +1623,8 @@ def execute(request, native_acceptance=False):
|
||||
if not armed:
|
||||
# Trusted fixed config makes a missing hook a veto, not an
|
||||
# after-the-fact substitute for pre-dpkg validation.
|
||||
require(installed_snapshot() == baseline, 'MISSING_HOOK_WITH_CHANGE')
|
||||
current = partial_installed_snapshot() if transaction.operation == 'configure_only' else installed_snapshot()
|
||||
require(current == baseline, 'MISSING_HOOK_WITH_CHANGE')
|
||||
return {'effect_state': 'known_failed', 'code': 'HOOK_NOT_HANDED_OFF',
|
||||
'evidence': {'test_acceptance': True, 'noProductionEvidence': True}
|
||||
if native_acceptance else {}}
|
||||
@@ -1561,7 +1710,38 @@ def prepare_baseline_store():
|
||||
'native_acceptance_created': False}
|
||||
|
||||
|
||||
def recovery_planning(request):
|
||||
"""Fresh passive projection of one ledger-verified, closed partial failure.
|
||||
|
||||
Rust verifies the signed original request, terminal failure and immutable
|
||||
SQLite proof before invoking this fixed mode. No job or execution is made.
|
||||
"""
|
||||
exact(request, 'native_recovery proof')
|
||||
ref, proof = request['native_recovery'], request['proof']
|
||||
validate_recovery_reference(ref)
|
||||
validate_partial_proof(proof)
|
||||
require(digest(canonical(proof)) == ref['partial_proof_sha256'] and
|
||||
proof['grant_id'] == ref['previous_grant_id'] and
|
||||
proof['attempt_id'] == ref['previous_attempt_id'], 'RECOVERY_PLANNING_PROOF_BINDING')
|
||||
fields = ('transaction_sha256 job_payload_sha256 effect_armed_ledger_id grant_id '
|
||||
'job_id attempt_id authorization_id plan_sha256')
|
||||
current = verify_partial({key: proof[key] for key in fields.split()})['proof']
|
||||
require({key: value for key, value in current.items() if key != 'checked_at_ms'} ==
|
||||
{key: value for key, value in proof.items() if key != 'checked_at_ms'},
|
||||
'RECOVERY_PLANNING_STATE_CHANGED')
|
||||
require(not os.path.lexists(BASE / ('recovery-attempt-' + ref['previous_grant_id'] + '.json')) and
|
||||
not os.path.lexists(BASE / ('recovery-' + ref['previous_grant_id'] + '.json')),
|
||||
'RECOVERY_ALREADY_ATTEMPTED')
|
||||
result = _planning_status(proof)
|
||||
result['native_recovery'] = ref
|
||||
return result
|
||||
|
||||
|
||||
def planning_status():
|
||||
return _planning_status()
|
||||
|
||||
|
||||
def _planning_status(recovery_proof=None):
|
||||
"""Fixed passive fixture projection; complete dpkg state remains root-private.
|
||||
|
||||
Only content-addressed, fsynced helper metadata may be created here. No
|
||||
@@ -1574,7 +1754,11 @@ def planning_status():
|
||||
require(not observe_host_frontend_lock() and
|
||||
not observe_host_frontend_lock(Path('/var/lib/dpkg/lock')), 'FOREIGN_PACKAGE_LOCK')
|
||||
fingerprint = status_fingerprint() # Vetoes dirty updates/pending triggers.
|
||||
snapshot = installed_snapshot()
|
||||
snapshot_reader = partial_installed_snapshot if recovery_proof is not None else installed_snapshot
|
||||
snapshot = snapshot_reader()
|
||||
if recovery_proof is not None:
|
||||
require(snapshot == recovery_proof['snapshot'] and fingerprint == recovery_proof['status_fingerprint'],
|
||||
'RECOVERY_PLANNING_STATE_CHANGED')
|
||||
runtime = runtime_identity()
|
||||
prefetch = {}
|
||||
for version in ('1.0', '1.1'):
|
||||
@@ -1590,7 +1774,7 @@ def planning_status():
|
||||
type(receipt['sealed_at_ms']) is int and 0 < receipt['sealed_at_ms'] <= time.time_ns() // 1000000,
|
||||
'PREFETCH_RECEIPT')
|
||||
prefetch[sha] = receipt
|
||||
require(status_fingerprint() == fingerprint and installed_snapshot() == snapshot,
|
||||
require(status_fingerprint() == fingerprint and snapshot_reader() == snapshot,
|
||||
'PLANNING_STATE_CHANGED')
|
||||
require(not observe_host_frontend_lock() and
|
||||
not observe_host_frontend_lock(Path('/var/lib/dpkg/lock')), 'FOREIGN_PACKAGE_LOCK')
|
||||
@@ -1615,7 +1799,7 @@ def planning_status():
|
||||
else:
|
||||
durable_once(path, snapshot)
|
||||
# Do not publish a stale baseline if state changed during fsync.
|
||||
require(status_fingerprint() == fingerprint and installed_snapshot() == snapshot,
|
||||
require(status_fingerprint() == fingerprint and snapshot_reader() == snapshot,
|
||||
'PLANNING_STATE_CHANGED')
|
||||
return {'observed_at': time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime()),
|
||||
'fixture_package': snapshot.get('rmm-mvp-test:all'),
|
||||
@@ -1839,6 +2023,8 @@ def main():
|
||||
sys.stdout.buffer.write(canonical(prepare_baseline_store()) + b'\n')
|
||||
elif mode == 'planning-status':
|
||||
sys.stdout.buffer.write(canonical(planning_status()) + b'\n')
|
||||
elif mode == 'recovery-planning':
|
||||
sys.stdout.buffer.write(canonical(recovery_planning(json_bytes(sys.stdin.buffer.read(MAX_INPUT + 1)))) + b'\n')
|
||||
elif mode == 'probe-native':
|
||||
sys.stdout.buffer.write(canonical(probe_native()) + b'\n')
|
||||
elif mode == 'probe-worker':
|
||||
|
||||
Reference in New Issue
Block a user