mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-29 15:44:26 +00:00
preload: Fix parsing of --add-certificate
option, amend help for --app
Connects-to: #2063 Change-type: patch
This commit is contained in:
parent
4373ba7a5d
commit
c245dc70c2
@ -2072,7 +2072,7 @@ the image file path
|
|||||||
|
|
||||||
#### -a, --app APP
|
#### -a, --app APP
|
||||||
|
|
||||||
name, slug or numeric ID of the application to preload
|
name of the application to preload
|
||||||
|
|
||||||
#### -c, --commit COMMIT
|
#### -c, --commit COMMIT
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ interface FlagsDef extends DockerConnectionCliFlags {
|
|||||||
'splash-image'?: string;
|
'splash-image'?: string;
|
||||||
'dont-check-arch': boolean;
|
'dont-check-arch': boolean;
|
||||||
'pin-device-to-release': boolean;
|
'pin-device-to-release': boolean;
|
||||||
'add-certificate'?: string;
|
'add-certificate'?: string[];
|
||||||
help: void;
|
help: void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ export default class PreloadCmd extends Command {
|
|||||||
|
|
||||||
public static flags: flags.Input<FlagsDef> = {
|
public static flags: flags.Input<FlagsDef> = {
|
||||||
app: flags.string({
|
app: flags.string({
|
||||||
description: 'name, slug or numeric ID of the application to preload',
|
description: 'name of the application to preload',
|
||||||
char: 'a',
|
char: 'a',
|
||||||
}),
|
}),
|
||||||
commit: flags.string({
|
commit: flags.string({
|
||||||
@ -115,6 +115,7 @@ The file name must end with '.crt' and must not be already contained in the prel
|
|||||||
/etc/ssl/certs folder.
|
/etc/ssl/certs folder.
|
||||||
Can be repeated to add multiple certificates.\
|
Can be repeated to add multiple certificates.\
|
||||||
`,
|
`,
|
||||||
|
multiple: true,
|
||||||
}),
|
}),
|
||||||
...dockerConnectionCliFlags,
|
...dockerConnectionCliFlags,
|
||||||
// Redefining --dockerPort here (defined already in dockerConnectionCliFlags)
|
// Redefining --dockerPort here (defined already in dockerConnectionCliFlags)
|
||||||
@ -201,14 +202,7 @@ Can be repeated to add multiple certificates.\
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let certificates: string[];
|
const certificates: string[] = options['add-certificate'] || [];
|
||||||
if (Array.isArray(options['add-certificate'])) {
|
|
||||||
certificates = options['add-certificate'];
|
|
||||||
} else if (options['add-certificate'] === undefined) {
|
|
||||||
certificates = [];
|
|
||||||
} else {
|
|
||||||
certificates = [options['add-certificate']];
|
|
||||||
}
|
|
||||||
for (const certificate of certificates) {
|
for (const certificate of certificates) {
|
||||||
if (!certificate.endsWith('.crt')) {
|
if (!certificate.endsWith('.crt')) {
|
||||||
throw new ExpectedError('Certificate file name must end with ".crt"');
|
throw new ExpectedError('Certificate file name must end with ".crt"');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user