Commit Graph

1822 Commits

Author SHA1 Message Date
Mitchell Hashimoto 3e8ea58585
command/connect/proxy: accept -service and -upstream 2018-06-14 09:42:21 -07:00
Mitchell Hashimoto b28e2b8622
connect/proxy: don't require proxy ID 2018-06-14 09:42:20 -07:00
Mitchell Hashimoto 1476745bdc
command/intention: address comment feedback 2018-06-14 09:42:20 -07:00
Mitchell Hashimoto 0fe99f4f14
command/intention/create: -replace does an atomic change 2018-06-14 09:42:20 -07:00
Mitchell Hashimoto f03fa81e6a
command/intention/match 2018-06-14 09:42:19 -07:00
Mitchell Hashimoto afbe0c3e6c
command/intention/delete: tests 2018-06-14 09:42:19 -07:00
Mitchell Hashimoto 15ce2643e5
command/intention/check: check tests 2018-06-14 09:42:19 -07:00
Mitchell Hashimoto 8df851c1ea
command/intention/get: tests 2018-06-14 09:42:19 -07:00
Mitchell Hashimoto 50e179c3af
command/intention/match 2018-06-14 09:42:19 -07:00
Mitchell Hashimoto 5ed57b393c
command/intentions/check 2018-06-14 09:42:19 -07:00
Mitchell Hashimoto e055f40612
command/intention/create: -replace flag, jank, we should change to PUT 2018-06-14 09:42:19 -07:00
Mitchell Hashimoto 4caeaaaa21
command/intentions/delete 2018-06-14 09:42:19 -07:00
Mitchell Hashimoto aead9cd422
command/intention/get: the get command without tests 2018-06-14 09:42:18 -07:00
Mitchell Hashimoto 77d0360de1
command/intention/finder: package for finding based on src/dst 2018-06-14 09:42:18 -07:00
Mitchell Hashimoto a1a7eaa876
command/intention/create 2018-06-14 09:42:18 -07:00
Mitchell Hashimoto 4100c9567f
command/connect/proxy: set ACL token based on proxy token flag 2018-06-14 09:42:14 -07:00
Mitchell Hashimoto 9435d8088c
command/connect/proxy: set proxy ID from env var if set 2018-06-14 09:42:14 -07:00
Paul Banks 153808db7c
Don't allow connect watches in agent/cli yet 2018-06-14 09:42:06 -07:00
Paul Banks 072b2a79ca
Support legacy watch.HandlerFunc type for backward compat reduces impact of change 2018-06-14 09:42:05 -07:00
Paul Banks 6f566f750e
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 51b1bc028d
Rework connect/proxy and command/connect/proxy. End to end demo working again 2018-06-14 09:41:57 -07:00
Paul Banks 800deb693c
Original proxy and connect.Client implementation. Working end to end. 2018-06-14 09:41:56 -07:00
Paul Banks 2973dd6a68
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 e043621dd3
Merge pull request #4156 from hashicorp/enterprise-coexistence
Enterprise/Licensing Cleanup
2018-06-05 10:50:32 -04:00
Paul Banks 0b9ff5c2b9
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 1e47c757c2
command/agent: don't re-parse the flags on reload 2018-05-31 16:59:51 -07:00
Matt Keeler 34c84aabb5 Move data source loading into a command helpers function 2018-05-24 10:34:08 -04:00
Paul Banks 06e1a62653
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 3026ac4198
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 be10300d06
Update make static-assets goal and run format 2018-04-13 09:57:25 -07:00
James Nugent e96b2b8d09 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 2e495ec8a6 Now use prometheus_retention_time > 0 to enable prometheus support 2018-04-06 14:21:05 +02:00
Pierre Souchay 583744d8c5 Added support exposing metrics in Prometheus format 2018-04-06 09:18:06 +02:00
Matt Keeler 8a9240ff78 Address PR feedback 2018-04-02 09:23:01 -04:00
Matt Keeler 5ddca9633f Update unit-tests to use requirements instead of manual checks. 2018-03-30 10:55:21 -04:00
Matt Keeler 3cefdd63d7 Update case of member in comment 2018-03-29 15:06:48 -04:00
Matt Keeler 7753fa25f6 Formatting update 2018-03-29 14:35:49 -04:00
Matt Keeler 0bf8adfbe0 GH-3996: Add config-format flag to validate subcommand 2018-03-29 14:30:05 -04:00
Guido Iaquinti 244fc72b05 Add package name to log output 2018-03-21 15:56:14 +00:00
Josh Soref 1dd8c378b9 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 69ebbf3e79
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 7f3a1c1175
Pull http config flag merge into public method 2018-02-05 15:00:04 -08:00
Veselkov Konstantin 05666113a4 remove golint warnings 2018-01-28 22:40:13 +04:00
Chad Whitacre 923e2c8535 Fix typo 2018-01-05 15:24:44 -05:00
Kyle Havlovitz 6b58df5898
Merge pull request #3737 from hashicorp/autopilot-refactor
Move autopilot to a standalone package
2017-12-15 14:09:40 -08:00
James Phillips 6cfb74d5bd
Adds -base64 support to kv get command.
Fixes #3736
2017-12-14 17:28:04 -08:00
Kyle Havlovitz 8546a1d3c6
Move autopilot to a standalone package 2017-12-11 16:45:33 -08:00
James Phillips 8fb08c7ede
Adds a registry mechanism for CLI commands. 2017-11-29 18:36:52 -08:00
Kyle Havlovitz fb464a8c0d
Fix a panic in snapshot inspect command 2017-10-30 14:51:08 -07:00
Frank Schroeder 1dab004335
Decouple the code that executes checks from the agent 2017-10-25 11:18:07 +02:00
Frank Schroeder a57e5acbf2
agent: fix TestRetryJoin 2017-10-24 20:35:37 +02:00
Frank Schroeder f398fe83b7
agent: fix TestRetryJoinFail 2017-10-24 20:35:37 +02:00
Frank Schroeder 8defdddf31
agent: fix TestRetryJoinWanFail 2017-10-24 20:35:36 +02:00
Frank Schroeder c624c72d5c
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 60af465b4e
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 3a5ac6f7cc
commands: add shorter helper vars to keep fmt sane 2017-10-18 02:39:10 +02:00
Frank Schroeder 4f6abf1e72
commands: cleanup init 2017-10-18 02:39:10 +02:00
Frank Schroeder 8f58a603ea commands: get HTTP API flags for usage automatically 2017-10-18 00:08:45 +02:00
Frank Schroeder cb8faa3559 commands: drop http server flags from reload command 2017-10-18 00:08:45 +02:00
Frank Schroeder a00f8721fb commands: drop http server flags from leave command 2017-10-18 00:08:45 +02:00
Frank Schroeder c877b3001b commands: drop http server flags from keyring command 2017-10-18 00:08:45 +02:00
Frank Schroeder 6032fe1407 commands: drop http server flags from force-leave command 2017-10-18 00:08:45 +02:00
Frank Schroeder c10885f828 commands: run all tests in parallel (again) 2017-10-18 00:08:45 +02:00
Frank Schroeder efab66e616 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 a3a805d7b8 commands: do not run cmd tests in parallel
Package level parallelization is sufficient.
2017-10-18 00:08:45 +02:00
Frank Schroeder a1a1a6971d commands: add missing noTabs test 2017-10-18 00:08:45 +02:00
Frank Schroeder a6d912adb4 commands: cleanup test names 2017-10-18 00:08:45 +02:00
Frank Schroeder 0e059248e7 commands: cleanup catalog list services tests 2017-10-18 00:08:45 +02:00
Frank Schroeder 915034da78 commands: cleanup catalog list nodes tests 2017-10-18 00:08:45 +02:00
Frank Schroeder 7d7281ab54 commands: simplify import names 2017-10-18 00:08:45 +02:00
Frank Schroeder 5a34eb1e52 commands: move operator subcommands to subdirs 2017-10-18 00:08:45 +02:00
Frank Schroeder f09f6f2ec2 commands: move kv subcommands to subdirs 2017-10-18 00:08:45 +02:00
Frank Schroeder 0a9478b1f1 commands: move catalog subcommands to subdirs 2017-10-18 00:08:45 +02:00
Frank Schroeder abd7c73627 commands: move snapshot subcommands to subdirs 2017-10-18 00:08:45 +02:00
Frank Schroeder 0fb4ea3a30 commands: simplify commands.go 2017-10-18 00:08:45 +02:00
Frank Schroeder 639bf6d8ec commands: drop base command and utils 2017-10-18 00:08:45 +02:00
Frank Schroeder a0b017d976 commands: move agent command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 127bd3d295 commands: move watch command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 3f7cfca203 add token and addr to http flags 2017-10-18 00:08:45 +02:00
Frank Schroeder 6998d82be5 commands: move snapshot save command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 3a16c93eab commands: move snapshot restore command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 758199813b commands: move version command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 776cffa33d commands: move snapshot inspect command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 8724aece07 commands: move snapshot command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 602e896fb9 commands: move rtt command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 1ba816b0ae commands: move reload command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder eb0640efd0 commands: move operator autopilot set command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 3dd4841b36 commands: move operator autopilot get command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 393bf50e71 commands: move operator autopilot command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder c024fcaaa5 commands: move operator list remove-peer command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 6850c8723f commands: move operator raft list-peers command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 78aa062990 commands: move operator raft command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder fe84af448b commands: move operator command to separate pkg 2017-10-18 00:08:45 +02:00
Preetha Appan 684362b1d0 Move monitor command to its own package 2017-10-18 00:08:45 +02:00
Preetha Appan 28490d6dcb Fix import order 2017-10-18 00:08:45 +02:00
Preetha Appan 4fa3987bdc Move members command to its own package 2017-10-18 00:08:45 +02:00
Preetha Appan 8d2e6f10c7 Move maint command to its own package 2017-10-18 00:08:45 +02:00
Preetha Appan 4b06c971d2 Move lock command to its own package 2017-10-18 00:08:45 +02:00
Preetha Appan e1935590b1 Fix leave and validate commands to build help string in constructor 2017-10-18 00:08:45 +02:00
Preetha Appan 3c4363389e Fix KV CLI subcommands to build help string in constructor 2017-10-18 00:08:45 +02:00
Preetha Appan 75ec8a29a3 Fix Keyring and keygen commands to build help string in constructor 2017-10-18 00:08:45 +02:00
Preetha Appan b8dd539037 Fix join command to build help string in constructor 2017-10-18 00:08:45 +02:00
Preetha Appan 0e1ee70a5e Fix up info and forceleave to build help string in constructor 2017-10-18 00:08:45 +02:00
Preetha Appan 95053297a9 s/initFlags/init/g 2017-10-18 00:08:45 +02:00
Preetha Appan 0cb1c92977 Fix exec and event commands to build help string in constructor 2017-10-18 00:08:45 +02:00
Preetha Appan 3bd4b738c0 Fix up catalog list services to build help string in constructor 2017-10-18 00:08:45 +02:00
Preetha Appan 8761232b2a Fix up list datacenters to build help string in constructor 2017-10-18 00:08:45 +02:00
Preetha Appan 5473dbc5a4 Fix tests by calling initFlags for each test case to reset state. 2017-10-18 00:08:45 +02:00
Preetha Appan 75ecc6a86e Better name for usage string and moving constant definition down 2017-10-18 00:08:45 +02:00
Preetha Appan 7898780106 Construct the help string in constructor using helper function. 2017-10-18 00:08:45 +02:00
Frank Schroeder 9825b6709a commands: move catalog list services to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 33a4e997b4 commands: move catalog list nodes command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder cfd110395b commands: move catalog list datacenters command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder bcf53b98d1 commands: move catalog command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 5d75449419 commands: move leave command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder ffb747a744 commands: move force-leave command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 41f13de7f5 commands: move keyring command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder b1dac89b95 commands: move kv put command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder e50c8d8f73 commands: move kv get command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 19f2dab416 commands: move kv import command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 3f0c61666d commands: move export entry struct to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 215cda4775 commands: move kv export command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 926aa72246 commands: move kv delete command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 50f039191d commands: move kv command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder bd825687dd commands: move keygen command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 74cf5c1c2c commands: move info command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder c1c883957f commands: move rExec helper to bottom 2017-10-18 00:08:45 +02:00
Frank Schroeder 8c7f013ae1 commands: move exec command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder ad50e2a410 commands: move event command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder dc3c722b2c commands: move join command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 8880ae714b commands: move validate command to separate pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder e65bd2a268 commands: move flag handling into flags pkg 2017-10-18 00:08:45 +02:00
Frank Schroeder 7568a19433 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 6f05ea91a3 Replace time.Now().Sub(x) with time.Since(x) 2017-10-17 20:38:24 +02:00
James Phillips e9670761f9
Cleans up some drift between the OSS and Enterprise trees. 2017-10-11 15:53:07 -07:00
Frank Schroeder db016a0c8d
command: show full help text on usage 2017-10-05 18:17:54 +02:00
Frank Schroeder 2320836d7f command: do not merge flags in-place 2017-10-05 18:08:35 +02:00
Frank Schroeder 56ebd5b30f command: simplify duplicate code 2017-10-05 18:08:35 +02:00
Frank Schroeder 3028d52158 command: drop hidden flags from base command 2017-10-05 18:08:35 +02:00
Frank Schroeder 13266a2e65 command: drop unused hidden flags for 'validate' 2017-10-05 18:08:35 +02:00
Frank Schroeder 7182829f15
command: drop legacy 'operator raft' tests 2017-10-05 17:56:16 +02:00
Frank Schroeder a4be9e2e67 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 cac55a1e80 command: don't show confusing error on usage output 2017-10-05 17:29:45 +02:00
Frank Schroeder 7bab8d3eb7 command: drop deprecated 'configtest' command
'configtest' has been replaced with 'validate'
2017-10-05 17:22:34 +02:00
Kyle Havlovitz dde743700f 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 be04bfed34 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 0063516e5e
Update metric names and add a legacy config flag 2017-10-04 16:43:27 -07:00
Kyle Havlovitz 624be65d35
Split BaseCommand http config into a separate function 2017-09-29 12:26:14 -07:00
Kyle Havlovitz 8403a98ea7
Add base command option for hiding generated help for normal args 2017-09-28 18:43:28 -07:00
James Phillips 7f02f9dad2
Returns errors properly from the consul operator raft list-peers command. 2017-09-28 15:37:59 -07:00