Merge pull request #2139 from balena-os/pin-device

Skip pin device step if release was deleted
This commit is contained in:
Felipe Lalanne 2023-03-13 15:48:36 -05:00 committed by GitHub
commit cd268d8b48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -302,9 +302,11 @@ async function pinDevice({ app, commit }: DevicePinInfo) {
const releaseId: number | undefined = release?.[0]?.id;
if (releaseId == null) {
throw new Error(
'Cannot continue pinning preloaded device! No release found!',
log.warn(
'Cannot pin device to release. Release no longer exists. Skipping.',
);
await config.remove('pinDevice');
return;
}
// We force a fresh get to make sure we have the latest state