mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-18 02:39:49 +00:00
Remove os download
command dependency for device init
Change-type: patch Signed-off-by: Scott Lowe <scott@balena.io>
This commit is contained in:
parent
1c17572db0
commit
5d3625f6ae
@ -92,6 +92,7 @@ export default class DeviceInitCmd extends Command {
|
||||
const tmpNameAsync = promisify(tmp.tmpName);
|
||||
tmp.setGracefulCleanup();
|
||||
const balena = getBalenaSdk();
|
||||
const { downloadOSImage } = await import('../../utils/cloud');
|
||||
const Logger = await import('../../utils/logger');
|
||||
|
||||
const logger = Logger.getLogger();
|
||||
@ -116,7 +117,8 @@ export default class DeviceInitCmd extends Command {
|
||||
const tmpPath = (await tmpNameAsync()) as string;
|
||||
try {
|
||||
logger.logDebug(`Downloading OS image...`);
|
||||
await this.downloadOsImage(tmpPath, application.device_type, options);
|
||||
const osVersion = options['os-version'] || 'default';
|
||||
await downloadOSImage(application.device_type, tmpPath, osVersion);
|
||||
|
||||
logger.logDebug(`Configuring OS image...`);
|
||||
await this.configureOsImage(tmpPath, device.uuid, options);
|
||||
@ -142,19 +144,6 @@ export default class DeviceInitCmd extends Command {
|
||||
return device.uuid;
|
||||
}
|
||||
|
||||
async downloadOsImage(path: string, deviceType: string, options: FlagsDef) {
|
||||
const osVersion = options['os-version'] || 'default';
|
||||
await runCommand([
|
||||
'os',
|
||||
'download',
|
||||
deviceType,
|
||||
'--output',
|
||||
path,
|
||||
'--version',
|
||||
osVersion,
|
||||
]);
|
||||
}
|
||||
|
||||
async configureOsImage(path: string, uuid: string, options: FlagsDef) {
|
||||
const configureCommand = ['os', 'configure', path, '--device', uuid];
|
||||
if (options.config) {
|
||||
|
Loading…
Reference in New Issue
Block a user