balena-cli
Version:
The official balena Command Line Interface
62 lines (57 loc) • 2.51 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@oclif/core");
const cf = require("../../utils/common-flags");
const lazy_1 = require("../../utils/lazy");
const messages_1 = require("../../utils/messages");
const validation_1 = require("../../utils/validation");
class JoinCmd extends core_1.Command {
async run() {
const { args: params, flags: options } = await this.parse(JoinCmd);
const promote = await Promise.resolve().then(() => require('../../utils/promote'));
const sdk = (0, lazy_1.getBalenaSdk)();
const Logger = await Promise.resolve().then(() => require('../../utils/logger'));
const logger = Logger.getLogger();
return promote.join(logger, sdk, params.deviceIpOrHostname, options.fleet, options.pollInterval);
}
}
JoinCmd.description = (0, lazy_1.stripIndent) `
Move a local device to a fleet on another balena server.
Move a local device to a fleet on another balena server, causing
the device to "join" the new server. The device must be running balenaOS.
For example, you could provision a device against an openBalena installation
where you perform end-to-end tests and then move it to balenaCloud when it's
ready for production.
To move a device between fleets on the same server, use the
\`balena device move\` command instead of \`balena join\`.
If you don't specify a device hostname or IP, this command will automatically
scan the local network for balenaOS devices and prompt you to select one
from an interactive picker. This may require administrator/root privileges.
Likewise, if the fleet option is not provided then a picker will be shown.
${messages_1.applicationIdInfo.split('\n').join('\n\t\t')}
`;
JoinCmd.examples = [
'$ balena join',
'$ balena join balena.local',
'$ balena join balena.local --fleet MyFleet',
'$ balena join balena.local -f myorg/myfleet',
'$ balena join 192.168.1.25',
'$ balena join 192.168.1.25 --fleet MyFleet',
];
JoinCmd.args = {
deviceIpOrHostname: core_1.Args.string({
description: 'the IP or hostname of device',
parse: validation_1.parseAsLocalHostnameOrIp,
}),
};
JoinCmd.flags = {
fleet: cf.fleet,
pollInterval: core_1.Flags.integer({
description: 'the interval in minutes to check for updates',
char: 'i',
}),
};
JoinCmd.authenticated = true;
JoinCmd.primary = true;
exports.default = JoinCmd;
//# sourceMappingURL=index.js.map
;