Commit Graph

1825 Commits

Author SHA1 Message Date
Mitchell Hashimoto b1d709fc9f
command/connect/proxy: -service-addr required for -listen 2018-06-14 09:42:21 -07:00
Mitchell Hashimoto 83f2509c6f
command/connect/proxy: can set public listener from flags 2018-06-14 09:42:21 -07:00
Mitchell Hashimoto c93ba83310
command/connect/proxy: tests for configuration 2018-06-14 09:42:21 -07:00
Mitchell Hashimoto 42ee214c8a
command/connect/proxy: accept -service and -upstream 2018-06-14 09:42:21 -07:00
Mitchell Hashimoto 8c713e6104
connect/proxy: don't require proxy ID 2018-06-14 09:42:20 -07:00
Mitchell Hashimoto a69e3087b2
command/intention: address comment feedback 2018-06-14 09:42:20 -07:00
Mitchell Hashimoto be82b94f81
command/intention/create: -replace does an atomic change 2018-06-14 09:42:20 -07:00
Mitchell Hashimoto 6a82e78cb4
command/intention/match 2018-06-14 09:42:19 -07:00
Mitchell Hashimoto 8ffca97596
command/intention/delete: tests 2018-06-14 09:42:19 -07:00
Mitchell Hashimoto 88639b802c
command/intention/check: check tests 2018-06-14 09:42:19 -07:00
Mitchell Hashimoto 971b3c06a1
command/intention/get: tests 2018-06-14 09:42:19 -07:00
Mitchell Hashimoto 66deffafbb
command/intention/match 2018-06-14 09:42:19 -07:00
Mitchell Hashimoto a083870872
command/intentions/check 2018-06-14 09:42:19 -07:00
Mitchell Hashimoto dba937847f
command/intention/create: -replace flag, jank, we should change to PUT 2018-06-14 09:42:19 -07:00
Mitchell Hashimoto 888dc78180
command/intentions/delete 2018-06-14 09:42:19 -07:00
Mitchell Hashimoto 272211e171
command/intention/get: the get command without tests 2018-06-14 09:42:18 -07:00
Mitchell Hashimoto 988d7d984a
command/intention/finder: package for finding based on src/dst 2018-06-14 09:42:18 -07:00
Mitchell Hashimoto 961e9c1eaf
command/intention/create 2018-06-14 09:42:18 -07:00
Mitchell Hashimoto 5d969e3cbb
command/connect/proxy: set ACL token based on proxy token flag 2018-06-14 09:42:14 -07:00
Mitchell Hashimoto 867db89303
command/connect/proxy: set proxy ID from env var if set 2018-06-14 09:42:14 -07:00
Paul Banks 1b197d934a
Don't allow connect watches in agent/cli yet 2018-06-14 09:42:06 -07:00
Paul Banks e8c510332c
Support legacy watch.HandlerFunc type for backward compat reduces impact of change 2018-06-14 09:42:05 -07:00
Paul Banks cd88b2a351
Basic `watch` support for connect proxy config and certificate endpoints.
- Includes some bug fixes for previous `api` work and `agent` that weren't tested
 - Needed somewhat pervasive changes to support hash based blocking - some TODOs left in our watch toolchain that will explicitly fail on hash-based watches.
 - Integration into `connect` is partially done here but still WIP
2018-06-14 09:42:05 -07:00
Paul Banks 10db79c8ae
Rework connect/proxy and command/connect/proxy. End to end demo working again 2018-06-14 09:41:57 -07:00
Paul Banks 69d5efdbbd
Original proxy and connect.Client implementation. Working end to end. 2018-06-14 09:41:56 -07:00
Paul Banks 5f3d20c5cf
Merge pull request #4194 from hashicorp/fix-kv-del-validation
Fix KV del command validation error
2018-06-05 16:58:14 +01:00
Matt Keeler 88a8c5e968
Merge pull request #4156 from hashicorp/enterprise-coexistence
Enterprise/Licensing Cleanup
2018-06-05 10:50:32 -04:00
Paul Banks 378c37fadd
Fix KV del command validation error
This has an explcit unit test already which somehow passes at least some of the time. I suspect it passes because under some conditions the actual KV delete fails and returns non-zero as well as printing the warning which is what is being checked for in the test.

For some reason despite working for quite some time like this, I now have a branch in which this test fails consistently. It may be a timing/env issue where another process running an agent causes the delete to be successful so the command returns a 0 by chance. Either way this is clearly wrong and fixing it stops the test being flaky in my branch.
2018-06-05 13:18:16 +01:00
Kyle Havlovitz 03652a8519
command/agent: don't re-parse the flags on reload 2018-05-31 16:59:51 -07:00
Matt Keeler 2e7a37890c Move data source loading into a command helpers function 2018-05-24 10:34:08 -04:00
Paul Banks 4de68fcb4b
Merge pull request #4016 from pierresouchay/support_for_prometheus
Support for prometheus for metrics endpoint
2018-04-24 16:14:43 +01:00
Matt Keeler 63250c5d43
Merge pull request #4024 from jen20/signal-notify-once
Only call signal.Notify once during agent startup
2018-04-20 12:37:01 -04:00
Kyle Havlovitz af4be34a2a
Update make static-assets goal and run format 2018-04-13 09:57:25 -07:00
James Nugent 96f871862e Only call signal.Notify once during agent startup
Calling twice appears to have no adverse effects, however serves to
confuse as to what the semantics of such code may be! This seems like it
was probably introduced while resolving conflicts during the merge of
the fix for #2404.
2018-04-10 20:44:50 -05:00
Pierre Souchay 93a01b0949 Now use prometheus_retention_time > 0 to enable prometheus support 2018-04-06 14:21:05 +02:00
Pierre Souchay fd98fb1449 Added support exposing metrics in Prometheus format 2018-04-06 09:18:06 +02:00
Matt Keeler 48bd84073a Address PR feedback 2018-04-02 09:23:01 -04:00
Matt Keeler 9f64d4856a Update unit-tests to use requirements instead of manual checks. 2018-03-30 10:55:21 -04:00
Matt Keeler 92ceaaad81 Update case of member in comment 2018-03-29 15:06:48 -04:00
Matt Keeler 4e6f0f9a79 Formatting update 2018-03-29 14:35:49 -04:00
Matt Keeler ada1252480 GH-3996: Add config-format flag to validate subcommand 2018-03-29 14:30:05 -04:00
Guido Iaquinti 8cd11d5888 Add package name to log output 2018-03-21 15:56:14 +00:00
Josh Soref 94835a2715 Spelling (#3958)
* spelling: another

* spelling: autopilot

* spelling: beginning

* spelling: circonus

* spelling: default

* spelling: definition

* spelling: distance

* spelling: encountered

* spelling: enterprise

* spelling: expands

* spelling: exits

* spelling: formatting

* spelling: health

* spelling: hierarchy

* spelling: imposed

* spelling: independence

* spelling: inspect

* spelling: last

* spelling: latest

* spelling: client

* spelling: message

* spelling: minimum

* spelling: notify

* spelling: nonexistent

* spelling: operator

* spelling: payload

* spelling: preceded

* spelling: prepared

* spelling: programmatically

* spelling: required

* spelling: reconcile

* spelling: responses

* spelling: request

* spelling: response

* spelling: results

* spelling: retrieve

* spelling: service

* spelling: significantly

* spelling: specifies

* spelling: supported

* spelling: synchronization

* spelling: synchronous

* spelling: themselves

* spelling: unexpected

* spelling: validations

* spelling: value
2018-03-19 16:56:00 +00:00
Paul Banks de58eb1820
Fixes #3891: agent monitor no longer unresponsive before logs stream.
The root cause is actually that the agent's streaming HTTP API didn't flush until the first log line was found which commonly was pretty soon since the default level is INFO. In cases where there were no logs immediately due to level for instance, the client gets stuck in the HTTP code waiting on a response packet from the server before we enter the loop that checks the shutdown channel from the signal handler.

This fix flushes the initial status immediately on the streaming endpoint which lets the client code get into it's expected state where it's listening for shutdown or log lines.
2018-02-19 21:53:10 +00:00
Kyle Havlovitz d16f103b48
Pull http config flag merge into public method 2018-02-05 15:00:04 -08:00
Veselkov Konstantin 7de57ba4de remove golint warnings 2018-01-28 22:40:13 +04:00
Chad Whitacre 9ff59df34b Fix typo 2018-01-05 15:24:44 -05:00
Kyle Havlovitz a86d11ec0a
Merge pull request #3737 from hashicorp/autopilot-refactor
Move autopilot to a standalone package
2017-12-15 14:09:40 -08:00
James Phillips c676e6b8c8
Adds -base64 support to kv get command.
Fixes #3736
2017-12-14 17:28:04 -08:00
Kyle Havlovitz de28555671
Move autopilot to a standalone package 2017-12-11 16:45:33 -08:00
James Phillips 521e46ce91
Adds a registry mechanism for CLI commands. 2017-11-29 18:36:52 -08:00
Kyle Havlovitz 921d2e1469
Fix a panic in snapshot inspect command 2017-10-30 14:51:08 -07:00
Frank Schroeder 8f145559d8
Decouple the code that executes checks from the agent 2017-10-25 11:18:07 +02:00
Frank Schroeder 9872475167
agent: fix TestRetryJoin 2017-10-24 20:35:37 +02:00
Frank Schroeder 7d3467176b
agent: fix TestRetryJoinFail 2017-10-24 20:35:37 +02:00
Frank Schroeder 96a584dee2
agent: fix TestRetryJoinWanFail 2017-10-24 20:35:36 +02:00
Frank Schroeder b97ab367f4
config: return error on extra command line arguments (#3397)
The `consul agent` command was ignoring extra command line arguments
which can lead to confusion when the user has for example forgotten to
add a dash in front of an argument or is not using an `=` when setting
boolean flags to `true`. `-bootstrap true` is not the same as
`-bootstrap=true`, for example.

Since all command line flags are known and we don't expect unparsed
arguments we can return an error. However, this may make it slightly
more difficult in the future if we ever wanted to have these kinds of
arguments.

Fixes #3397
2017-10-23 08:07:48 +02:00
James Phillips ecee15b466
Updates documentation for consul validate.
This makes it clear that you need to pass the full configuration,
and that the command won't work with config fragments.

Closes #3591
2017-10-19 18:59:05 -07:00
Frank Schroeder 9dec64dd17
commands: add shorter helper vars to keep fmt sane 2017-10-18 02:39:10 +02:00
Frank Schroeder 983e4aa0eb
commands: cleanup init 2017-10-18 02:39:10 +02:00
Frank Schroeder b3292d13fb commands: get HTTP API flags for usage automatically 2017-10-18 00:08:45 +02:00
Frank Schroeder 0cadee99ff commands: drop http server flags from reload command 2017-10-18 00:08:45 +02:00
Frank Schroeder cb96d1f126 commands: drop http server flags from leave command 2017-10-18 00:08:45 +02:00
Frank Schroeder cb95cf2a34 commands: drop http server flags from keyring command 2017-10-18 00:08:45 +02:00
Frank Schroeder 1715cbd5de commands: drop http server flags from force-leave command 2017-10-18 00:08:45 +02:00
Frank Schroeder 1b026de1db commands: run all tests in parallel (again) 2017-10-18 00:08:45 +02:00
Frank Schroeder 56b24d3d4f commands: cleanup help and synopsis.
* move Help and Synopsis to bottom
* make help and synopsis constants
* make sure help output is formatted
2017-10-18 00:08:45 +02:00
Frank Schroeder d54a5ef8d8 commands: do not run cmd tests in parallel
Package level parallelization is sufficient.
2017-10-18 00:08:45 +02:00
Frank Schroeder e5d08cf47d commands: add missing noTabs test 2017-10-18 00:08:45 +02:00
Frank Schroeder 84a82cff3d commands: cleanup test names 2017-10-18 00:08:45 +02:00
Frank Schroeder 5979723446 commands: cleanup catalog list services tests 2017-10-18 00:08:45 +02:00
Frank Schroeder a03738c117 commands: cleanup catalog list nodes tests 2017-10-18 00:08:45 +02:00
Frank Schroeder 2530b9dd83 commands: simplify import names 2017-10-18 00:08:45 +02:00
Frank Schroeder 2bd8b070fb commands: move operator subcommands to subdirs 2017-10-18 00:08:45 +02:00
Frank Schroeder ce1ec000ca commands: move kv subcommands to subdirs 2017-10-18 00:08:45 +02:00
Frank Schroeder e16ef316d4 commands: move catalog subcommands to subdirs 2017-10-18 00:08:45 +02:00
Frank Schroeder 51799e5d23 commands: move snapshot subcommands to subdirs 2017-10-18 00:08:45 +02:00
Frank Schroeder 6bc5716336 commands: simplify commands.go 2017-10-18 00:08:45 +02:00
Frank Schroeder 2850f0f6d0 commands: drop base command and utils 2017-10-18 00:08:45 +02:00
Frank Schroeder 31d5fb7f47 commands: move agent command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 10e0be65a9 commands: move watch command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 8a0195ee99 add token and addr to http flags 2017-10-18 00:08:45 +02:00
Frank Schroeder e2b686b982 commands: move snapshot save command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder fb1f09d447 commands: move snapshot restore command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 3acbc278f0 commands: move version command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 3a02ce9ebc commands: move snapshot inspect command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder c8992cbe28 commands: move snapshot command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 4d6a0b94dd commands: move rtt command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 566359234a commands: move reload command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 4947ba7f3d commands: move operator autopilot set command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder f719d78441 commands: move operator autopilot get command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder bd1b189990 commands: move operator autopilot command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder c50e43a4ea commands: move operator list remove-peer command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 2a824f0575 commands: move operator raft list-peers command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder f10f07b448 commands: move operator raft command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder cc103391b2 commands: move operator command to separate pkg 2017-10-18 00:08:45 +02:00
Preetha Appan 1eec0e757c Move monitor command to its own package 2017-10-18 00:08:45 +02:00
Preetha Appan f389fe7757 Fix import order 2017-10-18 00:08:45 +02:00
Preetha Appan 5b6f0504ae Move members command to its own package 2017-10-18 00:08:45 +02:00
Preetha Appan ba546b0c1d Move maint command to its own package 2017-10-18 00:08:45 +02:00
Preetha Appan ff4d070bdf Move lock command to its own package 2017-10-18 00:08:45 +02:00
Preetha Appan 85bc32f8a0 Fix leave and validate commands to build help string in constructor 2017-10-18 00:08:45 +02:00
Preetha Appan 71887d1709 Fix KV CLI subcommands to build help string in constructor 2017-10-18 00:08:45 +02:00
Preetha Appan b1d5f99a58 Fix Keyring and keygen commands to build help string in constructor 2017-10-18 00:08:45 +02:00
Preetha Appan 85a834d008 Fix join command to build help string in constructor 2017-10-18 00:08:45 +02:00
Preetha Appan a049dccd20 Fix up info and forceleave to build help string in constructor 2017-10-18 00:08:45 +02:00
Preetha Appan 55a1724b9e s/initFlags/init/g 2017-10-18 00:08:45 +02:00
Preetha Appan 7689e1e5cd Fix exec and event commands to build help string in constructor 2017-10-18 00:08:45 +02:00
Preetha Appan a2519fb76f Fix up catalog list services to build help string in constructor 2017-10-18 00:08:45 +02:00
Preetha Appan 2ed2c63a26 Fix up list datacenters to build help string in constructor 2017-10-18 00:08:45 +02:00
Preetha Appan 9d52f6ea92 Fix tests by calling initFlags for each test case to reset state. 2017-10-18 00:08:45 +02:00
Preetha Appan 4e31514df8 Better name for usage string and moving constant definition down 2017-10-18 00:08:45 +02:00
Preetha Appan a3863c73d6 Construct the help string in constructor using helper function. 2017-10-18 00:08:45 +02:00
Frank Schroeder 0ec520582d commands: move catalog list services to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 117305eb4f commands: move catalog list nodes command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder bd73c4cecf commands: move catalog list datacenters command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 675e727224 commands: move catalog command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 9a9e5ef82d commands: move leave command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 076361a37d commands: move force-leave command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 631502009d commands: move keyring command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 9e19207918 commands: move kv put command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 3377f46085 commands: move kv get command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder e1785a0e8f commands: move kv import command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder cce364445e commands: move export entry struct to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 585b5b8d4e commands: move kv export command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 5e3371eee1 commands: move kv delete command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 200199a875 commands: move kv command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder aca803ca8d commands: move keygen command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder b1c5ee39a5 commands: move info command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 8a5836368e commands: move rExec helper to bottom 2017-10-18 00:08:45 +02:00
Frank Schroeder 0ada23f92f commands: move exec command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 85bfd8f339 commands: move event command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder d870c6289b commands: move join command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder e0551b80a6 commands: move validate command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder cef6a80ae6 commands: move flag handling into flags pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder a49711b8bf config: refactor commands to print help for flags (#3536)
This patch refactors the commands that use the mitchellh/cli library to
populate the command line flag set in both the Run() and the Help()
method. Earlier versions of the mitchellh/cli library relied on the
Run() method to populuate the flagset for generating the usage screen.
This has changed in later versions and was previously solved with a
small monkey patch to the library to restore the old behavior.

However, this makes upgrading the library difficult since the patch has
to be restored every time.

This patch addresses this by moving the command line flags into an
initFlags() method where appropriate and also moving all variables for
the flags from the Run() method into the command itself.

Fixes #3536
2017-10-18 00:08:45 +02:00
Ryan Slade 85e4aea9d1 Replace time.Now().Sub(x) with time.Since(x) 2017-10-17 20:38:24 +02:00
James Phillips 575d70aaa7
Cleans up some drift between the OSS and Enterprise trees. 2017-10-11 15:53:07 -07:00
Frank Schroeder 7bee8e644d
command: show full help text on usage 2017-10-05 18:17:54 +02:00
Frank Schroeder bb13277ca1 command: do not merge flags in-place 2017-10-05 18:08:35 +02:00
Frank Schroeder e769cd22f6 command: simplify duplicate code 2017-10-05 18:08:35 +02:00
Frank Schroeder a364555121 command: drop hidden flags from base command 2017-10-05 18:08:35 +02:00
Frank Schroeder bc78fa576a command: drop unused hidden flags for 'validate' 2017-10-05 18:08:35 +02:00
Frank Schroeder 497d2702bf
command: drop legacy 'operator raft' tests 2017-10-05 17:56:16 +02:00
Frank Schroeder 4d604c5138 command: simplify 'operator raft'
The cli library can handle subcommands. Therefore, most of the code is
no longer necessary.
2017-10-05 17:40:57 +02:00
Frank Schroeder 3a7fb35fb0 command: don't show confusing error on usage output 2017-10-05 17:29:45 +02:00
Frank Schroeder ce0d03c46a command: drop deprecated 'configtest' command
'configtest' has been replaced with 'validate'
2017-10-05 17:22:34 +02:00
Kyle Havlovitz adf29675f3 Merge pull request #3535 from hashicorp/metric-docs
Update metric names and add a legacy config flag
2017-10-04 17:39:16 -07:00
Kyle Havlovitz 198ed6076d Clean up subprocess handling and make shell use optional (#3509)
* Clean up handling of subprocesses and make using a shell optional

* Update docs for subprocess changes

* Fix tests for new subprocess behavior

* More cleanup of subprocesses

* Minor adjustments and cleanup for subprocess logic

* Makes the watch handler reload test use the new path.

* Adds check tests for new args path, and updates existing tests to use new path.

* Adds support for script args in Docker checks.

* Fixes the sanitize unit test.

* Adds panic for unknown watch type, and reverts back to Run().

* Adds shell option back to consul lock command.

* Adds shell option back to consul exec command.

* Adds shell back into consul watch command.

* Refactors signal forwarding and makes Windows-friendly.

* Adds a clarifying comment.

* Changes error wording to a warning.

* Scopes signals to interrupt and kill.

This avoids us trying to send SIGCHILD to the dead process.

* Adds an error for shell=false for consul exec.

* Adds notes about the deprecated script and handler fields.

* De-nests an if statement.
2017-10-04 16:48:00 -07:00
Kyle Havlovitz c728564994
Update metric names and add a legacy config flag 2017-10-04 16:43:27 -07:00