Merge pull request #2533 from balena-io/2531-device-register-dt-param

device register: Add support for the `--deviceType` option
This commit is contained in:
bulldozer-balena[bot] 2022-10-12 13:31:08 +00:00 committed by GitHub
commit 6f54197b7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 51 additions and 15 deletions

View File

@ -1037,6 +1037,7 @@ Examples:
$ balena device register MyFleet $ balena device register MyFleet
$ balena device register MyFleet --uuid <uuid> $ balena device register MyFleet --uuid <uuid>
$ balena device register myorg/myfleet --uuid <uuid> $ balena device register myorg/myfleet --uuid <uuid>
$ balena device register myorg/myfleet --uuid <uuid> --deviceType <deviceTypeSlug>
### Arguments ### Arguments
@ -1050,6 +1051,10 @@ fleet name or slug (preferred)
custom uuid custom uuid
#### --deviceType DEVICETYPE
device type slug (run 'balena devices supported' for possible values)
## device rename &#60;uuid&#62; [newName] ## device rename &#60;uuid&#62; [newName]
Rename a device. Rename a device.

View File

@ -25,6 +25,7 @@ import { applicationIdInfo } from '../../utils/messages';
interface FlagsDef { interface FlagsDef {
uuid?: string; uuid?: string;
deviceType?: string;
help: void; help: void;
} }
@ -47,6 +48,7 @@ export default class DeviceRegisterCmd extends Command {
'$ balena device register MyFleet', '$ balena device register MyFleet',
'$ balena device register MyFleet --uuid <uuid>', '$ balena device register MyFleet --uuid <uuid>',
'$ balena device register myorg/myfleet --uuid <uuid>', '$ balena device register myorg/myfleet --uuid <uuid>',
'$ balena device register myorg/myfleet --uuid <uuid> --deviceType <deviceTypeSlug>',
]; ];
public static args: Array<IArg<any>> = [ca.fleetRequired]; public static args: Array<IArg<any>> = [ca.fleetRequired];
@ -58,6 +60,10 @@ export default class DeviceRegisterCmd extends Command {
description: 'custom uuid', description: 'custom uuid',
char: 'u', char: 'u',
}), }),
deviceType: flags.string({
description:
"device type slug (run 'balena devices supported' for possible values)",
}),
help: cf.help, help: cf.help,
}; };
@ -77,7 +83,11 @@ export default class DeviceRegisterCmd extends Command {
console.info(`Registering to ${application.slug}: ${uuid}`); console.info(`Registering to ${application.slug}: ${uuid}`);
const result = await balena.models.device.register(application.id, uuid); const result = await balena.models.device.register(
application.id,
uuid,
options.deviceType,
);
return result && result.uuid; return result && result.uuid;
} }

47
npm-shrinkwrap.json generated
View File

@ -4000,9 +4000,9 @@
} }
}, },
"balena-sdk": { "balena-sdk": {
"version": "16.22.0", "version": "16.28.0",
"resolved": "https://registry.npmjs.org/balena-sdk/-/balena-sdk-16.22.0.tgz", "resolved": "https://registry.npmjs.org/balena-sdk/-/balena-sdk-16.28.0.tgz",
"integrity": "sha512-HTEC8fYD0SZDlqgn0gcQ7EWliL9XIiGQ/P3f6xxvs4Nj0mG5wYtFrqK8dC6NAR0VQQxzWJtvM6iDFhshLIes7A==", "integrity": "sha512-pbpFavnCRxhWuXazKiJd9nKXi+ZbCEx87zbvCtgOxcSxf9ZkV1ypDUNSWsIjwjfp7Svyl/67OWYoQDwpMve1tg==",
"requires": { "requires": {
"@balena/es-version": "^1.0.0", "@balena/es-version": "^1.0.0",
"@types/json-schema": "^7.0.9", "@types/json-schema": "^7.0.9",
@ -4011,13 +4011,13 @@
"balena-auth": "^4.1.0", "balena-auth": "^4.1.0",
"balena-errors": "^4.7.1", "balena-errors": "^4.7.1",
"balena-hup-action-utils": "~4.1.0", "balena-hup-action-utils": "~4.1.0",
"balena-register-device": "^7.1.0", "balena-register-device": "^8.0.0",
"balena-request": "^11.5.5", "balena-request": "^11.5.5",
"balena-semver": "^2.3.0", "balena-semver": "^2.3.0",
"balena-settings-client": "^4.0.6", "balena-settings-client": "^4.0.6",
"date-fns": "^2.29.3",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"memoizee": "^0.4.15", "memoizee": "^0.4.15",
"moment": "^2.29.1",
"ndjson": "^2.0.0", "ndjson": "^2.0.0",
"pinejs-client-core": "^6.9.6", "pinejs-client-core": "^6.9.6",
"tslib": "^2.1.0" "tslib": "^2.1.0"
@ -4029,18 +4029,29 @@
"integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==" "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ=="
}, },
"balena-hup-action-utils": { "balena-hup-action-utils": {
"version": "4.1.1", "version": "4.1.3",
"resolved": "https://registry.npmjs.org/balena-hup-action-utils/-/balena-hup-action-utils-4.1.1.tgz", "resolved": "https://registry.npmjs.org/balena-hup-action-utils/-/balena-hup-action-utils-4.1.3.tgz",
"integrity": "sha512-VpyH3py5NPMBJe1fwj5NFUeq58i2V5VaXU1EMa0ja/kUCUwTM1HL5nfNNOU3bd66V+VGqCw49iO7Wppccg3pPg==", "integrity": "sha512-98SK5oTPgTKWsbEmPk0juI/ivT5qADsj/y+/B39I47lbDfPuhF/kHpgMI+xQCtT/GS+Dy3omkgY4nEcRI4CeoQ==",
"requires": { "requires": {
"balena-semver": "^2.0.0", "balena-semver": "^2.0.0",
"tslib": "^2.0.0" "tslib": "^2.0.0"
} }
}, },
"balena-register-device": {
"version": "8.0.4",
"resolved": "https://registry.npmjs.org/balena-register-device/-/balena-register-device-8.0.4.tgz",
"integrity": "sha512-4ziyefKEkdrzerwrrdEGq3hvY8wbzm+0iH3F+ZJAIVgxpYELfudNXQj8GJXHWzclUNbdBun7G5yiYpmdLs5G+g==",
"requires": {
"@types/uuid": "^8.3.0",
"tslib": "^2.2.0",
"typed-error": "^3.2.1",
"uuid": "^9.0.0"
}
},
"balena-request": { "balena-request": {
"version": "11.5.5", "version": "11.5.9",
"resolved": "https://registry.npmjs.org/balena-request/-/balena-request-11.5.5.tgz", "resolved": "https://registry.npmjs.org/balena-request/-/balena-request-11.5.9.tgz",
"integrity": "sha512-sQG+OBAUKOW4KENPRGqit/34l3kWZqoT+aUdpitIG8QdKUrRjKQkjkCmDzprDEDJuXfWoCToKdleN9tYwRCXEw==", "integrity": "sha512-SOnqpdySUdFNO6MLv187Q64EgJjytLxfkpst8amiPYt6EA591U0DQiZwwkUwNl+cg+YvkytEBWRYcWOhoTFcrg==",
"requires": { "requires": {
"@balena/node-web-streams": "^0.2.3", "@balena/node-web-streams": "^0.2.3",
"balena-errors": "^4.7.1", "balena-errors": "^4.7.1",
@ -4051,10 +4062,20 @@
"tslib": "^2.0.0" "tslib": "^2.0.0"
} }
}, },
"date-fns": {
"version": "2.29.3",
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.29.3.tgz",
"integrity": "sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA=="
},
"tslib": { "tslib": {
"version": "2.4.0", "version": "2.4.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz",
"integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ=="
},
"uuid": {
"version": "9.0.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz",
"integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg=="
} }
} }
}, },
@ -4595,7 +4616,7 @@
"buffer-shims": { "buffer-shims": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz", "resolved": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz",
"integrity": "sha1-mXjOMXOIxkmth5MCjDR37wRKi1E=" "integrity": "sha512-Zy8ZXMyxIT6RMTeY7OP/bDndfj6bwCan7SS98CEndS6deHwWPpseeHlwarNcBim+etXnF9HBc1non5JgDaJU1g=="
}, },
"buffers": { "buffers": {
"version": "0.1.1", "version": "0.1.1",
@ -16888,7 +16909,7 @@
"bluebird": { "bluebird": {
"version": "3.4.7", "version": "3.4.7",
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.4.7.tgz", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.4.7.tgz",
"integrity": "sha1-9y12C+Cbf3bQjtj66Ysomo0F+rM=" "integrity": "sha512-iD3898SR7sWVRHbiQv+sHUtHnMvC1o3nW5rAcqnq3uOn07DSAppZYUkIGslDz6gXC7HfunPe7YVBgoEJASPcHA=="
}, },
"process-nextick-args": { "process-nextick-args": {
"version": "1.0.7", "version": "1.0.7",

View File

@ -209,7 +209,7 @@
"balena-image-fs": "^7.0.6", "balena-image-fs": "^7.0.6",
"balena-image-manager": "^8.0.0", "balena-image-manager": "^8.0.0",
"balena-preload": "^12.1.0", "balena-preload": "^12.1.0",
"balena-sdk": "^16.22.0", "balena-sdk": "^16.28.0",
"balena-semver": "^2.3.0", "balena-semver": "^2.3.0",
"balena-settings-client": "^4.0.7", "balena-settings-client": "^4.0.7",
"balena-settings-storage": "^7.0.0", "balena-settings-storage": "^7.0.0",