mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-01-27 14:49:23 +00:00
Merge pull request #2369 from balena-os/remove-patch-device
Remove unused patchDevice function
This commit is contained in:
commit
70a4fa3274
@ -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(
|
||||
|
Loading…
x
Reference in New Issue
Block a user