mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-04-13 14:12:57 +00:00
device init: Avoid extra request when not providing the --fleet option
Change-type: patch
This commit is contained in:
parent
2b58143164
commit
063e9d40f0
@ -124,21 +124,16 @@ export default class DeviceInitCmd extends Command {
|
||||
const balena = getBalenaSdk();
|
||||
|
||||
// Get application and
|
||||
const application = await getApplication(
|
||||
balena,
|
||||
options.fleet ||
|
||||
(
|
||||
await (await import('../../utils/patterns')).selectApplication()
|
||||
).slug,
|
||||
{
|
||||
$select: ['id', 'slug'],
|
||||
$expand: {
|
||||
is_for__device_type: {
|
||||
$select: 'slug',
|
||||
const application = options.fleet
|
||||
? await getApplication(balena, options.fleet, {
|
||||
$select: ['id', 'slug'],
|
||||
$expand: {
|
||||
is_for__device_type: {
|
||||
$select: 'slug',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
);
|
||||
})
|
||||
: await (await import('../../utils/patterns')).selectApplication();
|
||||
|
||||
// Register new device
|
||||
const deviceUuid = balena.models.device.generateUniqueKey();
|
||||
|
Loading…
x
Reference in New Issue
Block a user