Only uninstall 'fleet' apps when localMode is set

Local mode is still a device level config. Eventually it will become a
property of an app, but for now, we don't want the supervisor trying to
uninstall supervisor or host app when local mode is set
This commit is contained in:
Felipe Lalanne
2021-09-21 20:33:32 +00:00
parent f1cd3d367c
commit 8bf8792583
4 changed files with 165 additions and 62 deletions

View File

@ -84,7 +84,13 @@ export async function getTargetApps(): Promise<DatabaseApp[]> {
]);
const source = localMode ? 'local' : apiEndpoint;
targetState = await db.models('app').where({ source });
targetState = await db
.models('app')
.where({ source })
// Local mode only applies for fleet "applications"
// this prevents the supervisor trying to uninstall
// the supervisor or host app for tri-app
.orWhereNot({ class: 'fleet' });
}
return targetState!;
}