From eccadbdcb9b5340d0e9d42fd9b9063255cad9fb0 Mon Sep 17 00:00:00 2001 From: Lucian Buzzo Date: Tue, 1 Feb 2022 17:43:28 +0000 Subject: [PATCH] Drop unused awaitDevice utility function Change-type: patch Signed-off-by: Lucian Buzzo --- lib/utils/patterns.ts | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/lib/utils/patterns.ts b/lib/utils/patterns.ts index 9503d1c8..338c2fc3 100644 --- a/lib/utils/patterns.ts +++ b/lib/utils/patterns.ts @@ -207,35 +207,6 @@ export async function selectOrganization(organizations?: Organization[]) { }); } -export async function awaitDevice(uuid: string) { - const balena = getBalenaSdk(); - const deviceName = await balena.models.device.getName(uuid); - const visuals = getVisuals(); - const spinner = new visuals.Spinner( - `Waiting for ${deviceName} to come online`, - ); - - const poll = async (): Promise => { - const isOnline = await balena.models.device.isOnline(uuid); - if (isOnline) { - spinner.stop(); - console.info(`The device **${deviceName}** is online!`); - return; - } else { - // Spinner implementation is smart enough to - // not start again if it was already started - spinner.start(); - - await delay(3000); - await poll(); - } - }; - - console.info(`Waiting for ${deviceName} to connect to balena...`); - await poll(); - return uuid; -} - export async function awaitDeviceOsUpdate( uuid: string, targetOsVersion: string,