Merge pull request #1190 from balena-io/push-logs-.local

Allow specifying a .local address for logs and push
This commit is contained in:
CameronDiver 2019-04-25 11:34:55 +01:00 committed by GitHub
commit a9aa7538f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 18 deletions

View File

@ -861,9 +861,9 @@ By default, the command prints all log messages and exits.
To continuously stream output, and see new logs in real time, use the `--tail` option.
If an IP address is passed to this command, logs are displayed from
If an IP or .local address is passed to this command, logs are displayed from
a local mode device with that address. Note that --tail is implied
when this command is provided an IP address.
when this command is provided a local mode device.
Logs from a single service can be displayed with the --service flag. Just system logs
can be shown with the --system flag. Note that these flags can be used together.
@ -872,12 +872,12 @@ Examples:
$ balena logs 23c73a1
$ balena logs 23c73a1 --tail
$ balena logs 23c73a1 --service my-service
$ balena logs 192.168.0.31
$ balena logs 192.168.0.31 --service my-service
$ balena logs 192.168.0.31 --system
$ balena logs 192.168.0.31 --system --service my-service
$ balena logs 23c73a1.local --system
$ balena logs 23c73a1.local --system --service my-service
### Options
@ -1454,10 +1454,10 @@ Examples:
$ balena push 10.0.0.1
$ balena push 10.0.0.1 --source <source directory>
$ balena push 10.0.0.1 -s <source directory>
$ balena push 10.0.0.1 --service my-service
$ balena push 10.0.0.1 --system
$ balena push 10.0.0.1 --system --service my-service
$ balena push 23c73a1.local --system
$ balena push 23c73a1.local --system --service my-service
### Options

View File

@ -18,6 +18,7 @@ import { CommandDefinition } from 'capitano';
import { stripIndent } from 'common-tags';
import { normalizeUuidProp } from '../utils/normalization';
import { validateDotLocalUrl } from '../utils/validation';
type CloudLog =
| {
@ -51,9 +52,9 @@ export const logs: CommandDefinition<
To continuously stream output, and see new logs in real time, use the \`--tail\` option.
If an IP address is passed to this command, logs are displayed from
If an IP or .local address is passed to this command, logs are displayed from
a local mode device with that address. Note that --tail is implied
when this command is provided an IP address.
when this command is provided a local mode device.
Logs from a single service can be displayed with the --service flag. Just system logs
can be shown with the --system flag. Note that these flags can be used together.
@ -62,12 +63,12 @@ export const logs: CommandDefinition<
$ balena logs 23c73a1
$ balena logs 23c73a1 --tail
$ balena logs 23c73a1 --service my-service
$ balena logs 192.168.0.31
$ balena logs 192.168.0.31 --service my-service
$ balena logs 192.168.0.31 --system
$ balena logs 192.168.0.31 --system --service my-service`,
$ balena logs 23c73a1.local --system
$ balena logs 23c73a1.local --system --service my-service`,
options: [
{
signature: 'tail',
@ -127,7 +128,10 @@ export const logs: CommandDefinition<
}
};
if (validateIPAddress(params.uuidOrDevice)) {
if (
validateIPAddress(params.uuidOrDevice) ||
validateDotLocalUrl(params.uuidOrDevice)
) {
const { DeviceAPI } = await import('../utils/device/api');
const deviceApi = new DeviceAPI(logger, params.uuidOrDevice);
logger.logDebug('Checking we can access device');

View File

@ -21,6 +21,7 @@ import { stripIndent } from 'common-tags';
import { registrySecretsHelp } from '../utils/messages';
import {
validateApplicationName,
validateDotLocalUrl,
validateIPAddress,
} from '../utils/validation';
@ -35,7 +36,7 @@ function getBuildTarget(appOrDevice: string): BuildTarget | null {
return BuildTarget.Cloud;
}
if (validateIPAddress(appOrDevice)) {
if (validateIPAddress(appOrDevice) || validateDotLocalUrl(appOrDevice)) {
return BuildTarget.Device;
}
@ -148,10 +149,10 @@ export const push: CommandDefinition<
$ balena push 10.0.0.1
$ balena push 10.0.0.1 --source <source directory>
$ balena push 10.0.0.1 -s <source directory>
$ balena push 10.0.0.1 --service my-service
$ balena push 10.0.0.1 --system
$ balena push 10.0.0.1 --system --service my-service
$ balena push 23c73a1.local --system
$ balena push 23c73a1.local --system --service my-service
`,
options: [
{