Commit Graph

17 Commits

Author SHA1 Message Date
Tim Gross 9fe88ebefe cli: support wildcard namespace in alloc subcommands (#18095)
The alloc exec and filesystem/logs commands allow passing the `-job` flag to
select a random allocation. If the namespace for the command is set to `*`, the
RPC handler doesn't handle this correctly as it's expecting to query for a
specific job. Most commands handle this ambiguity by first verifying that only a
single object of the type in question exists (ex. a single node or job).

Update these commands so that when the `-job` flag is set we first verify
there's a single job that matches. This also allows us to extend the
functionality to allow for the `-job` flag to support prefix matching.

Fixes: #12097
2023-07-31 13:15:49 -04:00
hashicorp-copywrite[bot] 005636afa0 [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
Yoan Blanc 3d96145ea5
feat: docker/docker/pkg/term has been deprecated in favor of moby/term
See https://github.com/moby/moby/pull/40825

Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
2022-06-26 15:35:27 +02:00
James Rasell 45f4689f9c
chore: fixup inconsistent method receiver names. (#11704) 2021-12-20 11:44:21 +01:00
Kris Hicks be6580bd28
Refactor alloc exec command (#9718)
This re-arranges the alloc exec Run implementation to have validation
hoisted as high as possible.
2021-01-05 09:33:04 -08:00
Kris Hicks 0a3a748053
Add gosimple linter (#9590) 2020-12-09 11:05:18 -08:00
Tim Gross f1ad512986 docs: describe required ACLs for all commands 2020-11-20 13:38:29 -05:00
Tim Gross de6b023af2 command: remove -namespace from help options when not applicable 2020-11-19 16:28:39 -05:00
Mahmood Ali 8d9ce41202 cli: query all namespaces for alloc subcommands 2020-06-17 16:31:06 -04:00
Buck Doyle 7e3188a4ea
CLI: Remove duplicated error output (#6738) 2019-11-19 16:05:53 -06:00
Mahmood Ali 591cb75ee4 nomad exec: check stdout for tty as well
When inferring whether to use TTY, check both stdin and stdout are
terminals.

Otherwise, we get failures like the following:

```
$ nomad alloc exec --job example echo hi
hi
$ echo | nomad alloc exec --job example echo hi
hi
$ nomad alloc exec --job example echo hi | head -n1
failed to exec into task: not a terminal
```
2019-11-12 11:39:06 -05:00
Mahmood Ali f5a4fcac3f Restore tty start before emitting errors
Otherwise, the error message appears indented unexpectedly.
2019-05-17 11:58:31 -04:00
Mahmood Ali 689453bd3a Implement escaping chrarcter for alloc exec 2019-05-16 16:22:52 -04:00
Mahmood Ali bfd229918a fix typo 2019-05-15 13:01:05 -04:00
Mahmood Ali 778c7a1982 Handle Terminal Output state in Windows 2019-05-15 10:37:37 -04:00
Mahmood Ali 1104827671 Add clarifying comments for negating `-i` or `-t` 2019-05-15 10:35:12 -04:00
Mahmood Ali 513303347c add CLI commands for nomad exec 2019-05-12 22:04:50 -04:00