mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-18 21:27:51 +00:00
Add provisioning key name option to config generate options
Change-Type: minor Signed-off-by: Nitish Agarwal 1592163+nitishagar@users.noreply.github.com
This commit is contained in:
parent
3b885ad906
commit
6ba67eefdb
@ -999,6 +999,10 @@ Check `balena util available-drives` for available options.
|
|||||||
|
|
||||||
path to the config JSON file, see `balena os build-config`
|
path to the config JSON file, see `balena os build-config`
|
||||||
|
|
||||||
|
#### --provisioning-key-name PROVISIONING-KEY-NAME
|
||||||
|
|
||||||
|
custom key name assigned to generated provisioning api key
|
||||||
|
|
||||||
## device local-mode <uuid>
|
## device local-mode <uuid>
|
||||||
|
|
||||||
Output current local mode status, or enable/disable local mode
|
Output current local mode status, or enable/disable local mode
|
||||||
@ -2479,6 +2483,10 @@ balenaOS version, for example "2.32.0" or "2.44.0+rev1"
|
|||||||
|
|
||||||
paths to local files to place into the 'system-connections' directory
|
paths to local files to place into the 'system-connections' directory
|
||||||
|
|
||||||
|
#### --provisioning-key-name PROVISIONING-KEY-NAME
|
||||||
|
|
||||||
|
custom key name assigned to generated provisioning api key
|
||||||
|
|
||||||
## os initialize <image>
|
## os initialize <image>
|
||||||
|
|
||||||
Initialize an os image for a device with a previously
|
Initialize an os image for a device with a previously
|
||||||
@ -2606,6 +2614,10 @@ the wifi ssid to use (used only if --network is set to wifi)
|
|||||||
|
|
||||||
the wifi key to use (used only if --network is set to wifi)
|
the wifi key to use (used only if --network is set to wifi)
|
||||||
|
|
||||||
|
#### --provisioning-key-name PROVISIONING-KEY-NAME
|
||||||
|
|
||||||
|
custom key name assigned to generated provisioning api key
|
||||||
|
|
||||||
## config inject <file>
|
## config inject <file>
|
||||||
|
|
||||||
Inject a 'config.json' file to a balenaOS image file or attached SD card or
|
Inject a 'config.json' file to a balenaOS image file or attached SD card or
|
||||||
|
@ -42,6 +42,7 @@ interface FlagsDef {
|
|||||||
wifiSsid?: string;
|
wifiSsid?: string;
|
||||||
wifiKey?: string;
|
wifiKey?: string;
|
||||||
appUpdatePollInterval?: string;
|
appUpdatePollInterval?: string;
|
||||||
|
'provisioning-key-name'?: string;
|
||||||
help: void;
|
help: void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,7 +95,10 @@ export default class ConfigGenerateCmd extends Command {
|
|||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
fleet: { ...cf.fleet, exclusive: ['application', 'app', 'device'] },
|
fleet: { ...cf.fleet, exclusive: ['application', 'app', 'device'] },
|
||||||
device: { ...cf.device, exclusive: ['application', 'app', 'fleet'] },
|
device: {
|
||||||
|
...cf.device,
|
||||||
|
exclusive: ['application', 'app', 'fleet', 'provisioning-key-name'],
|
||||||
|
},
|
||||||
deviceApiKey: flags.string({
|
deviceApiKey: flags.string({
|
||||||
description:
|
description:
|
||||||
'custom device key - note that this is only supported on balenaOS 2.0.3+',
|
'custom device key - note that this is only supported on balenaOS 2.0.3+',
|
||||||
@ -128,6 +132,10 @@ export default class ConfigGenerateCmd extends Command {
|
|||||||
description:
|
description:
|
||||||
'supervisor cloud polling interval in minutes (e.g. for variable updates)',
|
'supervisor cloud polling interval in minutes (e.g. for variable updates)',
|
||||||
}),
|
}),
|
||||||
|
'provisioning-key-name': flags.string({
|
||||||
|
description: 'custom key name assigned to generated provisioning api key',
|
||||||
|
exclusive: ['device'],
|
||||||
|
}),
|
||||||
help: cf.help,
|
help: cf.help,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -202,6 +210,7 @@ export default class ConfigGenerateCmd extends Command {
|
|||||||
override: options,
|
override: options,
|
||||||
});
|
});
|
||||||
answers.version = options.version;
|
answers.version = options.version;
|
||||||
|
answers.provisioningKeyName = options['provisioning-key-name'];
|
||||||
|
|
||||||
// Generate config
|
// Generate config
|
||||||
const { generateDeviceConfig, generateApplicationConfig } = await import(
|
const { generateDeviceConfig, generateApplicationConfig } = await import(
|
||||||
|
@ -37,6 +37,7 @@ interface FlagsDef {
|
|||||||
drive?: string;
|
drive?: string;
|
||||||
config?: string;
|
config?: string;
|
||||||
help: void;
|
help: void;
|
||||||
|
'provisioning-key-name'?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class DeviceInitCmd extends Command {
|
export default class DeviceInitCmd extends Command {
|
||||||
@ -106,6 +107,9 @@ export default class DeviceInitCmd extends Command {
|
|||||||
config: flags.string({
|
config: flags.string({
|
||||||
description: 'path to the config JSON file, see `balena os build-config`',
|
description: 'path to the config JSON file, see `balena os build-config`',
|
||||||
}),
|
}),
|
||||||
|
'provisioning-key-name': flags.string({
|
||||||
|
description: 'custom key name assigned to generated provisioning api key',
|
||||||
|
}),
|
||||||
help: cf.help,
|
help: cf.help,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -194,6 +198,13 @@ export default class DeviceInitCmd extends Command {
|
|||||||
} else if (options.advanced) {
|
} else if (options.advanced) {
|
||||||
configureCommand.push('--advanced');
|
configureCommand.push('--advanced');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options['provisioning-key-name']) {
|
||||||
|
configureCommand.push(
|
||||||
|
'--provisioning-key-name',
|
||||||
|
options['provisioning-key-name'],
|
||||||
|
);
|
||||||
|
}
|
||||||
await runCommand(configureCommand);
|
await runCommand(configureCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,6 +49,7 @@ interface FlagsDef {
|
|||||||
version?: string;
|
version?: string;
|
||||||
'system-connection': string[];
|
'system-connection': string[];
|
||||||
'initial-device-name'?: string;
|
'initial-device-name'?: string;
|
||||||
|
'provisioning-key-name'?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ArgsDef {
|
interface ArgsDef {
|
||||||
@ -62,6 +63,7 @@ interface Answers {
|
|||||||
version: string; // e.g. "2.32.0+rev1"
|
version: string; // e.g. "2.32.0+rev1"
|
||||||
wifiSsid?: string;
|
wifiSsid?: string;
|
||||||
wifiKey?: string;
|
wifiKey?: string;
|
||||||
|
provisioningKeyName?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const deviceApiKeyDeprecationMsg = stripIndent`
|
const deviceApiKeyDeprecationMsg = stripIndent`
|
||||||
@ -145,6 +147,7 @@ export default class OsConfigureCmd extends Command {
|
|||||||
config: flags.string({
|
config: flags.string({
|
||||||
description:
|
description:
|
||||||
'path to a pre-generated config.json file to be injected in the OS image',
|
'path to a pre-generated config.json file to be injected in the OS image',
|
||||||
|
exclusive: ['provisioning-key-name'],
|
||||||
}),
|
}),
|
||||||
'config-app-update-poll-interval': flags.integer({
|
'config-app-update-poll-interval': flags.integer({
|
||||||
description:
|
description:
|
||||||
@ -160,7 +163,10 @@ export default class OsConfigureCmd extends Command {
|
|||||||
'config-wifi-ssid': flags.string({
|
'config-wifi-ssid': flags.string({
|
||||||
description: 'WiFi SSID (network name) (non-interactive configuration)',
|
description: 'WiFi SSID (network name) (non-interactive configuration)',
|
||||||
}),
|
}),
|
||||||
device: { exclusive: ['app', 'application', 'fleet'], ...cf.device },
|
device: {
|
||||||
|
exclusive: ['app', 'application', 'fleet', 'provisioning-key-name'],
|
||||||
|
...cf.device,
|
||||||
|
},
|
||||||
'device-api-key': flags.string({
|
'device-api-key': flags.string({
|
||||||
char: 'k',
|
char: 'k',
|
||||||
description:
|
description:
|
||||||
@ -184,6 +190,10 @@ export default class OsConfigureCmd extends Command {
|
|||||||
description:
|
description:
|
||||||
"paths to local files to place into the 'system-connections' directory",
|
"paths to local files to place into the 'system-connections' directory",
|
||||||
}),
|
}),
|
||||||
|
'provisioning-key-name': flags.string({
|
||||||
|
description: 'custom key name assigned to generated provisioning api key',
|
||||||
|
exclusive: ['config', 'device'],
|
||||||
|
}),
|
||||||
help: cf.help,
|
help: cf.help,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -256,6 +266,8 @@ export default class OsConfigureCmd extends Command {
|
|||||||
options.version ||
|
options.version ||
|
||||||
(await getOsVersionFromImage(params.image, deviceTypeManifest, devInit));
|
(await getOsVersionFromImage(params.image, deviceTypeManifest, devInit));
|
||||||
|
|
||||||
|
answers.provisioningKeyName = options['provisioning-key-name'];
|
||||||
|
|
||||||
if (_.isEmpty(configJson)) {
|
if (_.isEmpty(configJson)) {
|
||||||
if (device) {
|
if (device) {
|
||||||
configJson = await generateDeviceConfig(
|
configJson = await generateDeviceConfig(
|
||||||
|
@ -58,6 +58,7 @@ if (process.platform !== 'win32') {
|
|||||||
'--config-app-update-poll-interval 10',
|
'--config-app-update-poll-interval 10',
|
||||||
'--config-network ethernet',
|
'--config-network ethernet',
|
||||||
'--initial-device-name testDeviceName',
|
'--initial-device-name testDeviceName',
|
||||||
|
'--provisioning-key-name testKey',
|
||||||
];
|
];
|
||||||
|
|
||||||
const { err } = await runCommand(command.join(' '));
|
const { err } = await runCommand(command.join(' '));
|
||||||
|
Loading…
Reference in New Issue
Block a user