Fix native media registration for managed IndeeHub stacks
This commit is contained in:
@@ -201,12 +201,12 @@ impl RpcHandler {
|
||||
anyhow::ensure!(
|
||||
state
|
||||
.package_data
|
||||
.get("indeedhub-api")
|
||||
.get("indeedhub")
|
||||
.is_some_and(|entry| matches!(
|
||||
entry.state,
|
||||
crate::data_model::PackageState::Running
|
||||
)),
|
||||
"The installed IndeeHub API must be running to register its media"
|
||||
"The installed IndeeHub app must be running to register its media"
|
||||
);
|
||||
let identity =
|
||||
crate::identity::NodeIdentity::load_existing(&self.config.data_dir.join("identity"))
|
||||
|
||||
@@ -48,6 +48,12 @@ pub(crate) fn installed_context(
|
||||
state: &crate::data_model::DataModel,
|
||||
) -> Result<InstalledAppContext> {
|
||||
for id in ["indeedhub", "indeedhub-api"] {
|
||||
// Stack components are not separate package records on managed installs.
|
||||
// Keep validating legacy standalone API records when they exist; the
|
||||
// installed parent and its existing API identity pin are mandatory.
|
||||
if id == "indeedhub-api" && !state.package_data.contains_key(id) {
|
||||
continue;
|
||||
}
|
||||
let entry = state
|
||||
.package_data
|
||||
.get(id)
|
||||
@@ -613,6 +619,12 @@ mod tests {
|
||||
assert!(installed_context(root.path(), &identity, &state).is_err());
|
||||
let pin = ensure_for_installation(root.path(), "indeedhub-api", &identity).unwrap();
|
||||
let first = installed_context(root.path(), &identity, &state).unwrap();
|
||||
let api_entry = state.package_data.remove("indeedhub-api").unwrap();
|
||||
assert_eq!(
|
||||
installed_context(root.path(), &identity, &state).unwrap(),
|
||||
first
|
||||
);
|
||||
state.package_data.insert("indeedhub-api".into(), api_entry);
|
||||
assert_eq!(first.app_audience, pin.app_audience);
|
||||
assert_eq!(first.app_origins, vec!["https://localhost:7778"]);
|
||||
state.package_data.get_mut("indeedhub-api").unwrap().state =
|
||||
|
||||
Reference in New Issue
Block a user