Merge pull request #2369 from balena-os/remove-patch-device

Remove unused patchDevice function
This commit is contained in:
flowzone-app[bot] 2024-08-29 16:35:17 +00:00 committed by GitHub
commit 70a4fa3274
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,4 +1,3 @@
import Bluebird from 'bluebird';
import { stripIndent } from 'common-tags';
import { isLeft } from 'fp-ts/lib/Either';
import * as t from 'io-ts';
@ -198,35 +197,6 @@ export async function start() {
}
}
export async function patchDevice(
id: number,
updatedFields: Dictionary<unknown>,
) {
const conf = await config.getMany(['unmanaged', 'provisioned', 'apiTimeout']);
if (conf.unmanaged) {
throw new Error('Cannot update device in unmanaged mode');
}
if (!conf.provisioned) {
throw new Error('Device must be provisioned to update a device');
}
if (balenaApi == null) {
throw new InternalInconsistencyError(
'Attempt to patch device without an API client',
);
}
return Bluebird.resolve(
balenaApi.patch({
resource: 'device',
id,
body: updatedFields,
}),
).timeout(conf.apiTimeout);
}
export function startCurrentStateReport() {
if (balenaApi == null) {
throw new InternalInconsistencyError(