feat: pass deployment receipts to configuration providers

This commit is contained in:
2026-08-07 11:15:49 +02:00
parent 44799b15e5
commit e04671034f
2 changed files with 64 additions and 0 deletions
@@ -152,6 +152,10 @@ from govoplan_core.core.configuration_packages import (
export_configuration_package,
validate_configuration_package_catalog,
)
from govoplan_core.core.infrastructure_capabilities import (
InfrastructureCapabilityReceiptError,
load_infrastructure_capability_receipt,
)
from govoplan_core.core.configuration_control import (
CONFIGURATION_CHANGE_RECORD_RESOURCE,
CONFIGURATION_CHANGE_REQUEST_RESOURCE,
@@ -1023,6 +1027,12 @@ def _configuration_context(
capabilities = {CONFIGURATION_PROVIDER_CAPABILITY, ACCESS_CONFIGURATION_CAPABILITY}
external_provider_declarations: dict[str, dict[str, object]] = {}
external_provider_states: dict[str, dict[str, object]] = {}
infrastructure_receipt = None
infrastructure_receipt_error = None
try:
infrastructure_receipt = load_infrastructure_capability_receipt()
except InfrastructureCapabilityReceiptError as exc:
infrastructure_receipt_error = str(exc)
if registry is not None and hasattr(registry, "manifests"):
manifests = registry.manifests()
installed_modules = {manifest.id: manifest.version for manifest in manifests}
@@ -1048,11 +1058,14 @@ def _configuration_context(
return ConfigurationPreflightContext(
tenant_id=tenant_id or principal.tenant_id,
operator_user_id=principal.user.id,
operator_scopes=frozenset(getattr(principal, "scopes", ())),
supplied_data=supplied_data or {},
installed_modules=installed_modules,
capabilities=frozenset(capabilities),
external_provider_declarations=external_provider_declarations,
external_provider_states=external_provider_states,
infrastructure_receipt=infrastructure_receipt,
infrastructure_receipt_error=infrastructure_receipt_error,
)