Commit Graph

1476 Commits

Author SHA1 Message Date
Alex Dadgar 8c1573642d status commands handle uuid prefixes with hyphens 2017-08-29 09:43:28 -07:00
Alex Dadgar cd613dfaa5 Status honors exact match and displays matches when more than one is available 2017-08-29 08:42:09 -07:00
Michael Schurter ad9c80e285 Merge pull request #3110 from hashicorp/f-commit-generated
Welcome to the brave new world
2017-08-28 16:23:29 -07:00
Alex Dadgar ac2e20d511 Document new status command
This PR documents the new status and job status command.
2017-08-28 16:05:58 -07:00
Michael Schurter 28e9fa73f6 Welcome to the brave new world
Committing generated code to help ensure reproducible builds.
2017-08-28 15:51:18 -07:00
Alex Dadgar e4581f0354 Remove tests checking autocomplete only does 1 arg 2017-08-28 15:42:32 -07:00
Alex Dadgar 5182ebb8cf don't limit on one arg 2017-08-28 13:40:04 -07:00
Alex Dadgar 1df249f1fb Reduce startup time on Mac
This PR moves creating the API client into the returned predict
function. The creation of the client causes a lookup of all the system
certificates and doing that for each command on mac was extremely slow.
2017-08-28 11:29:27 -07:00
Alex Dadgar d7d8661485 Search respects QueryOptions and returns QueryMeta
@chelseakomlo heads up on this change
2017-08-27 22:17:51 -07:00
Chelsea Holland Komlo 2edf966a62 get status of deployment via status cli command 2017-08-25 21:06:33 +00:00
Chelsea Holland Komlo 8cdc1ece99 add global flags to status; re-order functions 2017-08-25 19:47:21 +00:00
Chelsea Holland Komlo bd569bc4b9 refactor and fixups from code review 2017-08-25 17:34:05 +00:00
Chelsea Holland Komlo f32c90cfc0 cli help and logging formatting 2017-08-25 16:42:11 +00:00
Chelsea Holland Komlo 9968689344 fix up formatting of error message
fixups from code review
2017-08-25 16:42:11 +00:00
Chelsea Holland Komlo 2f0df8cd80 limit argument autocompletion to one 2017-08-25 16:42:11 +00:00
Chelsea Holland Komlo 7cdf28d303 use existing arg parsing functionality 2017-08-25 16:42:11 +00:00
Chelsea Holland Komlo 3d743a476a small fixups 2017-08-25 16:42:11 +00:00
Chelsea Holland Komlo d231b4aa0f fix autocomplete to list all matches 2017-08-25 16:42:11 +00:00
Chelsea Holland Komlo a05d7a2a20 default to job status if no arguments are provided 2017-08-25 16:42:11 +00:00
Chelsea Holland Komlo ffe95a1a62 adds any resource autocomplete
defaults to listing jobs if no id is provided
2017-08-25 16:42:11 +00:00
Alex Dadgar cf7a3fdf51 Autocomplete global flags 2017-08-23 23:29:29 +00:00
Chelsea Holland Komlo 8d4b963151 small fixes and cleanup 2017-08-23 23:04:47 +00:00
Chelsea Holland Komlo ed2a544502 add global flags to autocomplete 2017-08-23 22:58:44 +00:00
Chelsea Holland Komlo 35f5c8f2dd use PredictAnything when an flag accepts an argument 2017-08-23 22:58:44 +00:00
Chelsea Holland Komlo 2721e5890f enable autocompletion of flags 2017-08-23 22:57:07 +00:00
Alex Dadgar 2ee5b6c39d Change tty detection library 2017-08-23 14:35:50 -07:00
Alex Dadgar 3f0fc016e5 Detect STDOUT isn't a TTY and disable color
This PR disables color output when the STDOUT is not a TTY. This makes
running commands under `watch` or other commands nicer.
2017-08-23 14:35:26 -07:00
Alex Dadgar 00947f3ff4 move autocomplete functions to top for consistency of placement 2017-08-22 13:41:42 -07:00
Alex Dadgar f79c14ac4c flesh out the rest of the job subcommands 2017-08-22 13:39:06 -07:00
Alex Dadgar b41be1f85b update older autocomplete tests to inject state 2017-08-22 13:33:12 -07:00
Alex Dadgar e3a71f6c53 nomad stop 2017-08-22 13:22:29 -07:00
Alex Dadgar c172972b61 inspect 2017-08-22 13:19:29 -07:00
Alex Dadgar 554e17c3e9 node drain 2017-08-22 13:13:44 -07:00
Alex Dadgar 17e362e162 logs and fs 2017-08-22 13:11:32 -07:00
Alex Dadgar 02f26f3384 Autocomplete deployment commands 2017-08-22 13:05:24 -07:00
Alex Dadgar 422332c8bf Merge pull request #3002 from jrasell/gh_2993
Add the Nomad agent version to the node-status CLI output.
2017-08-22 10:43:25 -07:00
Chelsea Komlo 49542712f9 Merge pull request #3068 from hashicorp/f-add-deployments-search-api
Add deployments to search api
2017-08-21 16:34:00 -04:00
Chelsea Holland Komlo 50c20b1801 add deployments to search api 2017-08-21 15:20:55 +00:00
Michael Schurter 7f6e1f3a9c Initializing embedded structs is weird 2017-08-17 16:49:14 -07:00
Michael Schurter 0634eef12a Test createCheckReg 2017-08-17 16:49:14 -07:00
Michael Schurter bb8d5689d8 Add Header and Method support for HTTP checks 2017-08-17 16:44:21 -07:00
Michael Schurter b4813747d0 Merge pull request #3043 from hashicorp/f-2441-shutdown-delay
Add optional shutdown delay to tasks
2017-08-17 14:37:48 -07:00
Slobodan Mišković 7b5e5d695b Spelling fix: stana -> stanza 2017-08-16 23:32:41 -07:00
Michael Schurter d529b422b2 Add optional shutdown delay to tasks
Fixes #2441

Defaults to 0 (no delay) for backward compat and because this feature
should be opt-in.
2017-08-16 17:59:46 -07:00
Alex Dadgar d6187cd3e8 Fix tests 2017-08-16 16:26:52 -07:00
Alex Dadgar 1a86aecf55 Add version package
This PR adds a version package and consolidates version strings into a
Version struct.
2017-08-16 15:44:21 -07:00
James Rasell 0d120228ea Updates based on feedback provided by dadgar. 2017-08-16 22:19:31 +01:00
Chelsea Komlo 755cc33f13 Merge pull request #3037 from hashicorp/b-limit-tab-autocomplete
Tab completion should only happen once
2017-08-16 14:25:14 -04:00
Alex Dadgar 828b9bfae4 fix http test 2017-08-16 11:01:12 -07:00
Chelsea Holland Komlo c083af1e7c tab completion should only happen once 2017-08-16 17:04:47 +00:00
Chelsea Holland Komlo 68679ee265 tests for autocomplete functions 2017-08-15 20:21:50 +00:00
Chelsea Holland Komlo 499de71dfd adding autocomplete for nodes, evals, and jobs 2017-08-14 20:44:28 +00:00
Chelsea Komlo b9f189495a Merge pull request #2995 from hashicorp/f-allocation-autocomplete
Allocation autocomplete, client api
2017-08-14 15:26:39 -04:00
Chelsea Holland Komlo e658d4daaa fixups from code review 2017-08-14 17:56:03 +00:00
Alex Dadgar 43dff0a11d Fix integration test 2017-08-14 10:52:49 -07:00
Chelsea Holland Komlo 69c2b7e308 context constants should be in both api and structs pkg 2017-08-14 17:38:10 +00:00
Chelsea Holland Komlo 9bc48a01a6 using contexts constants in replace of string contexts
fix up endpoints
2017-08-14 17:38:10 +00:00
Chelsea Holland Komlo 76827c98f7 use constants for contexts 2017-08-14 17:38:10 +00:00
Chelsea Holland Komlo 465c4d7082 change endpoint to /v1/search 2017-08-14 17:38:10 +00:00
Chelsea Holland Komlo 5ee58a391b rename to cluster search
comment updates
2017-08-14 17:36:14 +00:00
Chelsea Holland Komlo 9402d330e8 autocomplete for allocation ids 2017-08-14 17:35:35 +00:00
James Nugent ae85c548ac build: Apply goimports formatting to various files
The following files were not formatted as the output of goimports(1)
would create, causing the goimports linter to fail:

command/agent/resources_endpoint.go
nomad/resources_endpoint.go
nomad/resources_endpoint_test.go
2017-08-14 11:51:47 +08:00
Alex Dadgar 6e20acb503 Merge pull request #2984 from hashicorp/b-tags
Fix alloc health with checks using interpolation
2017-08-10 13:07:25 -07:00
Alex Dadgar c8f74ac43b Address comments 2017-08-10 13:07:08 -07:00
Alex Dadgar 6b238edc22 Merge pull request #3001 from hashicorp/f-template-events
Template emits events explaining why it is blocked
2017-08-10 13:00:58 -07:00
“James d6d721d7c1 Add the Nomad agent version to the node-status CLI putput. 2017-08-10 08:27:26 +01:00
Chelsea Holland Komlo 869ee83b82 migrate nomad status to nomad job status 2017-08-09 15:16:04 +00:00
Alex Dadgar c8367ed01b Merge pull request #2988 from jvoorhis/redact-vault-token
Redact Vault.Token from AgentSelf response.
2017-08-08 11:04:48 -07:00
Jeremy Voorhis a19043e6c7 Handle nil values when redacting vault token. 2017-08-08 10:54:11 -07:00
Alex Dadgar aba107be99 Merge pull request #2979 from lfarnell/cleanup
Code cleanup
2017-08-08 10:21:15 -07:00
Jeremy Voorhis 554f6efe02 Redact Vault.Token from AgentSelf response.
If Config.Vault.Token is defined, /v1/agent/self will return the string
`<redacted>`. If the token is not set, This endpoint will continue to
return the empty string.
2017-08-07 21:34:43 -07:00
Alex Dadgar 4f6f6a13c8 Emit generic task events 2017-08-07 21:26:04 -07:00
Alex Dadgar 79d25b7db9 Merge pull request #2947 from hashicorp/f-vault-grace
Allow template to set Vault grace
2017-08-07 16:29:53 -07:00
Alex Dadgar d86b3977b9 Fix alloc health with checks using interpolation
Fixes an issue in which the allocation health watcher was checking for
allocations health based on un-interpolated services and checks. Change
the interface for retrieving check information from Consul to retrieving
all registered services and checks by allocation. In the future this
will allow us to output nicer messages.

Fixes https://github.com/hashicorp/nomad/issues/2969
2017-08-07 16:27:08 -07:00
Luke Farnell f0ced87b95 fixed all spelling mistakes for goreport 2017-08-07 17:13:05 -04:00
Chelsea Komlo 5537516bfd Merge pull request #2964 from hashicorp/f-autocomplete-api
autocomplete api
2017-08-07 12:40:09 -07:00
Chelsea Holland Komlo 1b77f9a216 further refactoring 2017-08-04 22:50:41 +00:00
Chelsea Holland Komlo 424e475333 if no context is specified, set maximum index for available contexts 2017-08-04 20:16:49 +00:00
Chelsea Holland Komlo 0b38704392 fix up tests to intantiate assertion test helper
add http tests for remaining contexts
2017-08-04 19:48:20 +00:00
Michael Schurter 5794e5ece7 Use int32 for atomic ops to avoid alignment issues
From https://golang.org/pkg/sync/atomic/#pkg-note-BUG :

On both ARM and x86-32, it is the caller's responsibility to arrange for
64-bit alignment of 64-bit words accessed atomically. The first word in
a global variable or in an allocated struct or slice can be relied upon
to be 64-bit aligned.
2017-08-04 10:14:16 -07:00
Chelsea Holland Komlo 111019642b resources are expected by state store to be plural 2017-08-04 15:07:34 +00:00
Chelsea Holland Komlo b2b4c5d7af add documentation
extract magic number into variable
2017-08-04 14:34:25 +00:00
Chelsea Holland Komlo b6f459a7a9 refactor rpc endpoint and tests
add test for when no prefixes are matched

add test for no context at HTTP api
2017-08-04 14:34:25 +00:00
Chelsea Holland Komlo 7b7a80d6ce resources list endpoint accepts http POST and PUT
set the index for a resources response
2017-08-04 14:34:25 +00:00
Chelsea Holland Komlo 312bb19e1c refactor and add error handling for invalid context type 2017-08-04 14:34:25 +00:00
Chelsea Holland Komlo ef5a62aaa1 use upsert as a test helper 2017-08-04 14:34:25 +00:00
Chelsea Holland Komlo 0026a308ec add truncation boolean to response 2017-08-04 14:34:25 +00:00
Chelsea Holland Komlo 06f10d2e5f adds evaluations
makes context singular
2017-08-04 14:34:25 +00:00
Chelsea Holland Komlo 92cc40f1de change resources endpoint from http get to post 2017-08-04 14:34:25 +00:00
Chelsea Holland Komlo 64a83edd9f remove resourceliststub, no need for another layer of abstraction 2017-08-04 14:34:25 +00:00
Chelsea Holland Komlo 36285a4b23 test resources endpoint will return matching prefixes 2017-08-04 14:34:25 +00:00
Chelsea Holland Komlo ecd0d85a4e adding test validation that received resources matches requested 2017-08-04 14:34:25 +00:00
Chelsea Holland Komlo 4dd6b46198 Retrieve job information for resources endpoint
requires further refactoring and logic for more contexts
2017-08-04 14:34:25 +00:00
Alex Dadgar 067a638478 Allow template to set Vault grace
This PR allows a template to specify the Vault grace duration.

Fixes https://github.com/hashicorp/nomad/issues/2922
2017-08-01 14:14:08 -07:00
Dom Udall cde3da569e Fixing spelling mistake
Updating `deregistraion` -> `deregistration`
2017-08-01 10:26:52 +01:00
Alex Dadgar 7cd6040bdf Merge pull request #2929 from hashicorp/b-status-panic
Ensure backwards compatibility between 0.6.X CLI and 0.5.X
2017-07-31 11:23:37 -07:00
James Nugent bf13a0cd90 meta: Fix goimports for command/agent/syslog.go 2017-07-30 08:56:40 -05:00
Alex Dadgar eef3b15005 Ensure backwards compatibility between 0.6.X CLI and 0.5.X
This PR goes through the CLI commands and ensures that a 0.6.X cli
gracefully handles interacting with a 0.5.X Nomad Agent.

Fixes https://github.com/hashicorp/nomad/issues/2918
2017-07-28 10:20:47 -07:00
Michael Schurter 7cbae6e168 Merge pull request #2899 from hashicorp/d-mention-env-in-init
Mention env templates in nomad init
2017-07-26 11:17:47 -07:00
Alex Dadgar e0beda704a New commands docs and small fixes
This PR adds the command documentations and has small CLI fixes.
2017-07-25 17:37:09 -07:00
Alex Dadgar a271b8fc22 inspect 2017-07-25 17:37:09 -07:00
Alex Dadgar f8b9fc4124 Fix eval-status bug 2017-07-25 17:37:09 -07:00
Michael Schurter 9099371a42 Mention restart 2017-07-25 16:26:42 -07:00
Michael Schurter d2f8fdcad5 Fix comment 2017-07-25 12:13:05 -07:00
Michael Schurter 3e6231842d Forgot to setcmdenv
This would leak a consul agent
2017-07-25 12:09:57 -07:00
Michael Schurter da6a5ddaf0 Mention env templates in nomad init 2017-07-25 10:28:50 -07:00
Michael Schurter 4b83eba599 Use seen more conservatively 2017-07-24 16:48:40 -07:00
Michael Schurter cdf138eb27 Always increment failures...
...as it's used in calculating the backoff
2017-07-24 15:37:53 -07:00
Michael Schurter 809724ad8d Track whether Consul has ever been seen
Need a way to squelch Consul operation errors on shutdown. If it's never
been seen don't log errors about deregs failing.
2017-07-24 12:12:02 -07:00
Michael Schurter edbe62a879 Synchronously deregister agent on shutdown
Fixes #2891

Previously the agent services and checks were being asynchrously
deregistered on shutdown, so it was a race between the sync goroutine
deregistering them and Nomad shutting down.

This switches to synchronously deregister agent serivces and checks
which doesn't really have a downside since the sync goroutines retry
behavior doesn't help on shutdown anyway.
2017-07-24 11:40:37 -07:00
Alex Dadgar 553bc91725 Parallel client tests (#2890)
* alloc_runner

* Random tests

* parallel task_runner and no exec compatible check

* Parallel client

* Fail fast and use random ports

* Fix docker port mapping

* Make concurrent pull less timing dependant

* up parallel

* Fixes

* don't build chroots in parallel on travis

* Reduce parallelism on travis with lxc/rkt

* make java test app not run forever

* drop parallelism a little

* use docker ports that are out of the os's ephemeral port range

* Limit even more on travis

* rkt deadline
2017-07-22 19:04:36 -07:00
Alex Dadgar 4dd5d943c7 remove root requirement on consul integration check 2017-07-21 19:32:41 -07:00
Alex Dadgar 56f9cf86df Speed up client startup 2017-07-20 22:34:24 -07:00
Alex Dadgar d7fee07ebc Parallel 2017-07-20 21:24:21 -07:00
Alex Dadgar c106df9215 Switch to in-process agent 2017-07-20 21:07:32 -07:00
Alex Dadgar d019eed363 Merge pull request #2874 from hashicorp/f-command-agent-tests
Parallelize the command/agent tests and add new test agent
2017-07-20 20:27:49 -07:00
Alex Dadgar 5df9be0ccb Fix bootstrapping and waiting 2017-07-20 20:15:37 -07:00
Alex Dadgar 15fad96c21 Merge pull request #2868 from hashicorp/f-feedback
Variety of UX fixes
2017-07-20 17:43:42 -07:00
Alex Dadgar da13d5a61c Fix test 2017-07-20 17:42:58 -07:00
Alex Dadgar 40ca1298b3 Multiple matched objects now treated as an error condition. 2017-07-20 17:31:07 -07:00
Michael Schurter 6b2cb6bb23 Don't display UNIX epoch dates
Submitted times are UNIX epoch for jobs created before 0.6 which is
confusing in the CLI. Display nothing instead (formatted as "<none>").
2017-07-20 15:43:00 -07:00
Alex Dadgar 4e90d56098 More parallel 2017-07-20 09:36:34 -07:00
Alex Dadgar 9037693436 New test agent 2017-07-19 22:14:36 -07:00
Alex Dadgar 9a2a5af608 Don't print atlas 2017-07-19 20:25:06 -07:00
Alex Dadgar d5278a62e7 Job promote command 2017-07-19 15:39:32 -07:00
Alex Dadgar 5a526d9f37 Inspect job at a particular version 2017-07-19 13:44:30 -07:00
Alex Dadgar 39e7a26e5d Small fixes and UX changes 2017-07-19 13:34:24 -07:00
Alex Dadgar 18c7043a30 Merge pull request #2866 from hashicorp/f-autocomplete-agent
Agent command autocompletes to hcl/json files
2017-07-19 13:18:32 -07:00
Michael Schurter c9e4c041b3 Too lazy to remember the right formatter for floats 2017-07-19 11:53:18 -07:00
Alex Dadgar b4b50b636f Fix predictor 2017-07-19 11:51:01 -07:00
Alex Dadgar 871cdcb932 Agent command autocompletes to hcl/json files 2017-07-19 11:28:16 -07:00
Michael Schurter 40c2d4e5eb Merge pull request #2858 from hashicorp/b-2849-deploy-json
Implement -json for job deployments
2017-07-19 10:15:01 -07:00
Michael Schurter 125a3fb2f9 Error -> Errof 2017-07-19 10:00:57 -07:00
Alex Dadgar 747d67eb3f Allow tuning of heartbeat ttls
This PR allows tuning of heartbeat TTLs. An example of very aggressive
settings is as follows:

```
server {
  heartbeat_grace = "1s"
  min_heartbeat_ttl = "1s"
  max_heartbeats_per_second = 200.0
}
```
2017-07-19 09:38:35 -07:00
Michael Schurter 3eaa3b2ec3 Implement -json for job deployments
Fixes #2849
2017-07-18 17:28:44 -07:00
Michael Schurter dbcb19c6d9 Merge pull request #2854 from hashicorp/b-2827-agent-services
Never remove unknown agent services
2017-07-18 14:48:36 -07:00
Michael Schurter 99d1486f32 Never remove unknown agent services
Fixes #2827

This is a tradeoff. The pro is that you can run separate client and
server agents on the same node and advertise both. The con is that if a
Nomad agent crashes and isn't restarted on that node in the same mode
its entry will not be cleaned up.

That con scenario seems far less likely to occur than the scenario on
the pro side, and even if we do leak an agent entry the checks will be
failing so nothing should attempt to use it.
2017-07-18 13:23:01 -07:00
Alex Dadgar 484e9f2693 Autocomplete files
This PR makes run, validate and plan autocomplete their arg to
appropriate files.
2017-07-18 13:18:17 -07:00
Alex Dadgar c10b6c0560 Merge pull request #2842 from hashicorp/d-init
Update init command to show new update stanza.
2017-07-17 15:04:49 -07:00
Alex Dadgar 53bcc6a2cc spelling errors 2017-07-17 11:19:37 -07:00
Alex Dadgar df3d9229fe Allow cli package to handle version.
This PR removes our custom handling of the version flag and updates job
history to use a version flag instead of `-job-version`.
2017-07-17 11:04:07 -07:00
Alex Dadgar 129d5fd4c3 Update init command to show new update stanza. 2017-07-16 11:12:43 -07:00
Alex Dadgar 05894f4611 Small fixes 2017-07-07 17:34:50 -07:00
Alex Dadgar 45712c6ca3 test fixes 2017-07-07 14:11:27 -07:00
Alex Dadgar bf2dafb8e9 check id method name changed 2017-07-07 12:15:09 -07:00
Alex Dadgar ade9a7c768 @jippi Changed my mind! Good suggestion 2017-07-07 12:12:48 -07:00
Alex Dadgar e6f5e3f301 deployment status in job status view 2017-07-07 12:12:48 -07:00
Alex Dadgar 770af68119 alloc-status 2017-07-07 12:12:48 -07:00
Alex Dadgar 40b04a5ea9 alloc-list shows version 2017-07-07 12:12:48 -07:00
Alex Dadgar 7867f2cdb8 deployment status indicates whether canaries were promoted 2017-07-07 12:12:48 -07:00