Commit Graph

903 Commits

Author SHA1 Message Date
Michael Klishin cb41fe932d Unbreak with_distribution/1 2016-12-05 19:23:20 +03:00
Michael Klishin 3deb0df90f Merge branch 'handle-distribution-errors' of https://github.com/binarin/rabbitmq-cli into binarin-handle-distribution-errors 2016-12-05 18:42:27 +03:00
Alexey Lebedeff 2d11e45625 Handle errors from distribution start attempts
Otherwise broken or misconfigured distribution is reported as an
unavailable broker node.
2016-12-05 17:51:22 +03:00
Michael Klishin 511a898a8f Wording 2016-12-05 17:39:38 +03:00
Michael Klishin e17c809530 Switch to a documented inet* function
References #137.
2016-12-05 17:38:16 +03:00
Alexey Lebedeff fcd23a6ca3 Fix longname-mode on hosts without detectable FQDN
Re-implement https://github.com/rabbitmq/rabbitmq-server/issues/890

CLI tools fail in longnames-mode if erlang is not able to determine host
FQDN (with at least one dot in it). E.g. this happens on docker.

And it was not possible to alleviate this situation using any options
from http://erlang.org/doc/apps/erts/inet_cfg.html
2016-12-05 16:06:52 +03:00
Michael Klishin ba0efb56b0 Merge pull request #133 from rabbitmq/rabbitmq-cli-129
Load command specific options from a single command
2016-12-03 11:32:44 +03:00
Michael Klishin f788060718 Extract function 2016-12-03 11:20:02 +03:00
Daniil Fedotov c62d48380a Load command specific options from a single command 2016-11-30 16:51:59 +00:00
Arnaud Cogoluègnes 409f8e3b00 Use 1 RPC call to get running plugins 2016-11-30 17:19:13 +01:00
Arnaud Cogoluègnes fd07c8b70b Support several versions of plugins in directories
References #131
2016-11-29 17:33:41 +01:00
Arnaud Cogoluègnes 304ab703f4 Support multiple plugins directories
References #131
2016-11-29 15:26:57 +01:00
Michael Klishin 95d7d055f2 Merge pull request #130 from rabbitmq/rabbitmq-cli-123
Make `rabbitmqctl stop` support an optional pid file argument
2016-11-23 21:19:15 +03:00
Michael Klishin 94c21f4a40 Make `rabbitmqctl stop` support an optional pid file argument
While at it, move test/helpers_test.exs under test/core.

This slightly changes command output (mentions what file path is used
or what its contents are when we cannot parse it). We try hard
to not introduce any breaking changes compared to the 3.6.x CLI
tools but in this case it's an improvement.
Also, no one should depend on `rabbitmqctl stop` output, only UNIX
exit code, which did not change.
2016-11-23 21:11:01 +03:00
Arnaud Cogoluègnes fcd7b66299 Add banner to encode command
Fixes #118
2016-11-23 10:18:20 +01:00
Arnaud Cogoluègnes fc08e50e88 Merge branch 'master' into rabbitmq-cli-118 2016-11-23 09:21:56 +01:00
Daniil Fedotov e3289ed454 Remove empty switches and aliases 2016-11-22 18:32:12 +00:00
Arnaud Cogoluègnes 887a09644b Merge branch 'master' into rabbitmq-cli-118 2016-11-22 16:51:27 +01:00
Michael Klishin 266a4f664e Make StopCommand#validate/2 accept a pidfile path 2016-11-22 17:23:19 +03:00
Michael Klishin c59b6c029f Make switches/0 and aliases/0 optional command callbacks
Fixes #120. Same as #124 but doesn't include any unrelated changes
and thus suffer from #126.
2016-11-22 16:11:25 +03:00
Michael Klishin e92022da11 Revert "Merge pull request #124 from rabbitmq/rabbitmq-cli-120"
This reverts commit c087a635c0, reversing
changes made to 59225a551d.

See https://github.com/rabbitmq/rabbitmq-cli/issues/126, which exposed
a serious flaw in the option parser split which was introduced
as part of #124.

Reopens #120.
2016-11-22 14:07:58 +03:00
Daniil Fedotov 5607b92e32 Remove empty switches/0 and aliases/0 callbacks 2016-11-21 11:26:40 +00:00
Daniil Fedotov cc87a49f93 Make switches as aliases callbacks optional 2016-11-18 17:21:27 +00:00
Daniil Fedotov 59225a551d Remove `flags/0` callback. Remove command modules helpers from helpers to command_modules 2016-11-18 14:12:53 +00:00
Arnaud Cogoluègnes 5e16943fe4 Add encode command
Catching up with rabbitmq/rabbitmq-server#979.

Fixes #118
2016-11-18 14:52:29 +01:00
Michael Klishin 0aa7bf6f9b Merge branch 'master' into rabbitmq-server-1030 2016-11-17 21:36:23 +03:00
Daniil Fedotov a664f83b9f Fix stream output for csv formatter 2016-11-17 16:09:18 +00:00
Daniil Fedotov e4ebdaabde Make rabbit node resolve from environment variable by default 2016-11-17 14:16:00 +00:00
Arnaud Cogoluègnes 061dc48e96 Use binaries for policy RPC call
Part of rabbitmq/rabbitmq-server#1030
2016-11-17 09:54:11 +01:00
Daniil Fedotov 77e17ddf13 Printer behaviour 2016-11-16 13:46:36 +00:00
Michael Klishin 0d61a2b0d0 Use Erlang term formatter by default for status
Fixes #106.
2016-11-16 00:15:44 +03:00
Michael Klishin 1cf7b70bc1 Merge pull request #116 from rabbitmq/rabbitmq-cli-115
CSV formatter
2016-11-15 22:05:48 +03:00
Daniil Fedotov 82026a0ec8 More global switches to control environment 2016-11-15 16:14:10 +00:00
Daniil Fedotov f160f0536a New exec command to execute elixir code locally in command context. 2016-11-15 16:12:41 +00:00
Daniil Fedotov 4c05e343d7 Format CSV info items with helpers 2016-11-15 11:31:59 +00:00
Daniil Fedotov cb52a66d70 CSV formatter 2016-11-15 11:14:44 +00:00
Daniil Fedotov ccb6bf116c Namespace refactoring 2016-11-14 17:52:08 +00:00
Milton Mazzarri 6795aec784 Improve code consistency
* Fix some code consistency issues, mostly spaces around parenthesis, brackets and operators.
* Write large number with underscores (example: 70_000 instead of 70000)
* Write variable names in snake_case
* Remove trailing white spaces
2016-11-13 00:29:17 -06:00
Daniil Fedotov 31848069e2 Use RABBITMQ_NODENAME as default node 2016-11-11 11:12:09 +00:00
Daniil Fedotov 1dc8e90a70 Make tests happy 2016-11-10 17:40:43 +00:00
Daniil Fedotov 6c98c51a7d Call rabbit:alarms instead of rabbit:status to get alarms 2016-11-10 16:01:41 +00:00
Daniil Fedotov 3c8e6d1ef7 Use seconds in timeout parameter. Better timeout error report 2016-11-10 14:53:59 +00:00
Daniil Fedotov 63382a3b18 Force non infinity timeout for node health check. Node health check output 2016-11-10 13:51:01 +00:00
Daniil Fedotov 8f601a4bbe Erlang terms formatter name 2016-11-10 13:01:49 +00:00
Daniil Fedotov 7dd74a3232 Erlang terms formatter 2016-11-10 12:19:47 +00:00
Daniil Fedotov ca69dff530 Handle non-list format_output in table formatter 2016-11-10 12:12:17 +00:00
Daniil Fedotov 58af1261b1 Flatten list_consumers output in table formatter 2016-11-09 18:18:32 +00:00
Daniil Fedotov 0d88314c50 It's not a map, it's a keyword list 2016-11-09 17:11:51 +00:00
Daniil Fedotov b984a423bf Support --local argument in list_queues 2016-11-09 17:02:05 +00:00
Daniil Fedotov b436f52797 Proper error handling 2016-11-09 17:02:05 +00:00
Daniil Fedotov dae427bbf9 Handle non-error outputs in wait command 2016-11-09 13:03:35 +00:00
Daniil Fedotov 9ebf876c9a Do not require ENABLED_PLUGINS_FILE to run ctl, still print an error 2016-11-08 14:45:59 +00:00
Daniil Fedotov 4d0f9b1fb5 Load commands from plugins 2016-11-08 14:25:14 +00:00
Daniil Fedotov b0f59ead31 Fix tests 2016-11-08 14:23:09 +00:00
Daniil Fedotov ad90e60121 script name is overridable via argument 2016-11-08 14:21:31 +00:00
Daniil Fedotov 60fdcecdb4 Format disabled plugins 2016-11-08 14:19:11 +00:00
Daniil Fedotov 3e3d8f3f0b Fix tests for plugins commands 2016-11-08 14:19:11 +00:00
Daniil Fedotov b8c7360b14 Plugins enable/disable command formatter 2016-11-08 14:19:11 +00:00
Daniil Fedotov b98470288d List plugins formatter 2016-11-08 14:19:11 +00:00
Daniil Fedotov 4733765759 Better generic formatting. No tests for format_error 2016-11-08 10:11:07 +00:00
Michael Klishin db194fb013 Merge branch 'master' into rabbitmq-cli-105
Conflicts:
	test/forget_cluster_node_command_test.exs
	test/rename_cluster_node_command_test.exs
2016-11-07 22:37:24 +03:00
Daniil Fedotov 837226430b Coordinate environment with config module 2016-11-07 22:03:09 +03:00
Michael Klishin e423453159 Add a missing clause 2016-11-07 09:45:43 -08:00
Daniil Fedotov 08e263ab2a Vhost limits commands 2016-11-07 14:08:26 +00:00
Daniil Fedotov 85d6868763 Make table formatter look like in the old CLI 2016-11-04 12:38:35 +00:00
Daniil Fedotov 603dfd4cf0 Add optional callbacks to the command behaviour 2016-11-04 11:29:14 +00:00
Daniil Fedotov aaabab1fe9 Enable table formatter for each list_ command 2016-11-04 11:17:02 +00:00
Daniil Fedotov 14d82eabdc Refactor error reporting to allow commands specify formatter 2016-11-04 11:11:03 +00:00
Daniil Fedotov 3f4abba717 Command specific formatters 2016-11-03 18:10:18 +00:00
Daniil Fedotov cb3e54d8d8 Table formatter 2016-10-31 18:07:24 +00:00
Michael Klishin 74cb3a2b53 diag, diagnostic => diagnostics 2016-10-12 01:07:40 +03:00
Daniil Fedotov 70b867e908 Naming 2016-10-07 14:57:10 +01:00
Daniil Fedotov 41f38e29f8 Make read-only commands part of the rabbitmq-diag tool 2016-10-07 14:36:54 +01:00
Michael Klishin e1de90218c Merge pull request #104 from rabbitmq/rabbitmq-cli-101
Operator policies commands
2016-09-08 15:35:56 +04:00
Daniil Fedotov 599cede1df Convert error_string char list to string 2016-09-08 11:03:08 +01:00
Daniil Fedotov 3ac39162be Operator policies commands 2016-09-08 11:02:21 +01:00
Daniil Fedotov fe3e83ec50 Fixing some tests 2016-09-07 12:46:47 +01:00
Michael Klishin 4a277f1fdd A bit of docs 2016-09-05 13:29:11 +03:00
Michael Klishin 64ee6dfaf2 Wording 2016-09-05 13:06:45 +03:00
Michael Klishin b65d8649cd Cosmetics 2016-09-05 12:47:59 +03:00
Michael Klishin 59a57a8d37 Merge branch 'master' into rabbitmq-cli-90 2016-09-05 12:44:18 +03:00
Daniil Fedotov a7fe88e74c Example json formatter. Remove IO.puts from commands 2016-08-23 14:28:07 +01:00
Daniil Fedotov 57550182e1 Specific output tests 2016-08-22 15:05:17 +01:00
Daniil Fedotov 6d2208063f Write to file using file printer 2016-08-22 14:19:15 +01:00
Daniil Fedotov c88eb090f3 File printer 2016-08-22 14:13:38 +01:00
Daniil Fedotov 4c13a51ac8 Reworking command outputs 2016-08-22 12:58:37 +01:00
Daniil Fedotov 616476cc66 Remove duplicate require_rabbit function 2016-08-18 17:55:29 +01:00
Daniil Fedotov 0da30bd1d1 Help command return list of strings instead of printing them\ 2016-08-18 17:38:49 +01:00
Daniil Fedotov 35fc3d12cd Default output formatting and exit code selection. Inspect printer 2016-08-18 15:35:49 +01:00
Michael Klishin b154b998ca Make sure rabbit_event is functional
It will be required as of server#500.
2016-08-18 12:09:27 +03:00
Daniil Fedotov 4b25f8ab18 Add rabbit plugins to path when requiring rabbit to be loaded 2016-08-17 17:06:15 +01:00
Andrew Bruce 19f0ba94d3 Inline default_opts
[#127359637]
2016-08-15 15:09:12 +01:00
Andrew Bruce 541ad4249c Fix merge_defaults implementations
...and don't default inside run methods.

Defaults must go on left-hand-side of `Map.merge`, or they'll clobber
user-defined settings.

Remove some unnecessary pattern matching.

Issue #92

[#127359637]
2016-08-15 14:21:15 +01:00
Michael Klishin 4e45a52dd4 Fix an IO.puts/1 line ported from io:format/2 too literally 2016-08-14 08:37:32 +03:00
Michael Klishin 49e9cb2909 pong and pang are atoms 2016-08-14 08:16:44 +03:00
Michael Klishin b57e8e16cc Don't rely on rabbit_control_main; coerce node names to atoms
`rabbit_control_main` is going away due to the very existence of
these new CLI tools.
2016-08-12 04:46:26 +03:00
Michael Klishin cb209d834d Merge branch 'master' into rabbitmq-cli-rename-cluster-node-command
Conflicts:
	lib/rabbitmqctl.ex
2016-08-12 04:36:51 +03:00
Michael Klishin 508a906bf9 Wording, add aliases to UpdateClusterNodesCommand 2016-08-12 02:34:43 +03:00
Michael Klishin 17773fcd1f Merge branch 'master' into rabbitmq-cli-update-cluster-nodes 2016-08-12 01:56:12 +03:00
Michael Klishin 0e8ab49937 Brush up tests, support both "disc" and "disk"
as the current `rabbitmqctl` does.
2016-08-12 01:54:23 +03:00
Michael Klishin 0449004a6b Merge branch 'master' into rabbitmq-cli-change-cluster-node-type 2016-08-12 01:04:01 +03:00
Michael Klishin 81ea222428 Fix CLI arguments parsing for policies, brush up tests
Policy commands now work on the CLI against an actual node.
2016-08-11 17:15:43 +03:00
Michael Klishin e9ef2cff34 Merge branch 'master' into rabbitmq-cli-policies-commands 2016-08-11 13:58:11 +03:00
Michael Klishin ad2b4627c7 Merge branch 'master' into rabbitmq-cli-9
Conflicts:
	lib/rabbitmq/cli/ctl/parser.ex
	lib/rabbitmqctl.ex
2016-08-11 11:52:54 +03:00
Michael Klishin ef2c06f0f4 Merge branch 'master' into rabbitmq-cli-force-boot-command 2016-08-11 11:12:59 +03:00
Michael Klishin 29c3bf3f43 Wording, cosmetics 2016-08-11 10:56:32 +03:00
Michael Klishin cb03611e2a Merge branch 'master' into rabbitmq-cli-78 2016-08-11 10:49:39 +03:00
Michael Klishin 7525ee3373 Cosmetics 2016-08-11 09:52:37 +03:00
Michael Klishin 76fb17d8f2 Use MapSet.difference/2 here, too 2016-08-11 09:37:48 +03:00
Michael Klishin 30e0c66127 Use sets in more places; rabbit_plugins:ensure/1 expects an Erlang list
Both CLI and tests now generally work as expected.
2016-08-11 01:44:27 +03:00
Michael Klishin 05db449187 Handle duplicates on plugin lists, be more defensive with defaults
Makes CLI invocations of `rabbitmq-plugins {enable, disable, list}`
mostly work.
2016-08-11 01:27:13 +03:00
Michael Klishin 31c3356c56 Use effective program name in help command output
Note that this solution is imperfect because
for tests the name of the tool is `mix`. But most
tests don't care.
2016-08-09 15:05:48 +03:00
Michael Klishin bec4e6f4f9 Drop rabbitmq-plugins active_plugins
`rabbitmq-plugins list` with flags can do the same thing.

Per discussion with @hairyhum.
2016-08-09 13:46:20 +03:00
Michael Klishin eef1c36024 Drop _plugins from plugin management module names 2016-08-09 00:03:58 +03:00
Daniil Fedotov ca98b02656 Implement policy management commands 2016-07-29 14:59:19 +01:00
Daniil Fedotov 4d40649d44 Command auto completion 2016-07-28 17:46:37 +01:00
Daniil Fedotov a0c5af375b Implement forget_cluster_node command 2016-07-27 14:41:02 +01:00
Daniil Fedotov e89bf53357 Do not require rabbit as dependency 2016-07-27 12:27:27 +01:00
Daniil Fedotov 7b35c7c2cc More validation, error handling and tests 2016-07-27 11:48:24 +01:00
Daniil Fedotov f2c4986fcf Implementing rename_cluster_nodes command 2016-07-26 18:08:37 +01:00
Daniil Fedotov cd68b3ce9c Implement change_cluster_node_type command 2016-07-25 16:48:45 +01:00
Daniil Fedotov 12cbd50f10 Implement update_cluster_nodes command 2016-07-25 15:11:05 +01:00
Daniil Fedotov 0eee8e2446 Implement force_boot command 2016-07-25 14:01:41 +01:00
Daniil Fedotov 57c4a0fa69 Fix some tests 2016-07-25 14:00:55 +01:00
Daniil Fedotov a84cd93d2e Implement eval command 2016-07-22 17:17:15 +01:00
Michael Klishin 58708b6ac3 Merge branch 'master' into rabbitmq-cli-83 2016-07-15 23:54:48 +03:00
Michael Klishin 909a3b41fe Adapt to recent server rabbit_health_check changes 2016-07-15 23:47:15 +03:00
Michael Klishin 786ec7672d Rename 2016-07-10 21:36:12 +03:00
Michael Klishin 09fc873a34 Improve a couple of error atoms 2016-07-10 19:47:27 +03:00
Michael Klishin 70f486c27d Squash a few compilation warnings 2016-07-10 12:08:33 +03:00
Michael Klishin 941263e83c Eliminate several warnings 2016-06-26 22:47:37 +03:00
Daniil Fedotov 5b828c7e64 Tests for command modules 2016-06-23 12:33:39 +01:00
Daniil Fedotov 5c5f4d4414 Plugins command tests 2016-06-23 10:50:01 +01:00
Daniil Fedotov eda1e7cac2 Tests for list plugins command 2016-06-23 10:50:01 +01:00
Daniil Fedotov 963f6a2ff9 tests for list plugins command 2016-06-23 10:50:01 +01:00
Daniil Fedotov 2415ee58aa Plugin management commands 2016-06-23 10:50:01 +01:00
Daniil Fedotov 75d8632d87 Aliases in behaviour. List plugins command 2016-06-23 10:50:01 +01:00
Daniil Fedotov 33caaecb9b Select command scope by namespace 2016-06-23 10:50:01 +01:00
Daniil Fedotov 0d026a5f4a Example plugins command 2016-06-23 10:50:01 +01:00
Daniil Fedotov deb6e99b49 Removed scopes from command behaviour 2016-06-23 10:50:01 +01:00
Daniil Fedotov 9baa5c1ebe Load commands from load path. Specify scope in application config by file name 2016-06-23 10:50:01 +01:00
Daniil Fedotov 1f3bc3e6d7 Use scopes and separate Mix projects to generate escripts 2016-06-23 10:50:01 +01:00
Michael Klishin 78ae2585a3 Inline 2016-06-15 00:22:42 +03:00
Michael Klishin bc5ff3bf26 Merge pull request #79 from rabbitmq/rabbitmq-cli-69
Purge queue command
2016-06-14 23:07:55 +03:00
Michael Klishin 2d68d42241 Assert that messages were purged; don't assume 0 messages were deleted 2016-06-14 23:04:27 +03:00
Michael Klishin d77eb83c5f A few Helpers.parse_node calls are no longer necessary
[Finish ##121221959]
2016-06-14 14:21:16 +03:00
Andrew Bruce ec3a191515 Purge queue command
This initial version makes two RPC calls:

1. Gets the amqqueue resource
2. Makes the purge request using that resource

Issue #69
2016-06-14 10:31:47 +01:00
Michael Klishin 39b3de4d1e Namespace commands, fixes #74
Note that the top level module is not namespaced. It's
not clear to me if it should be or will be end up using
and (Elixir/Mix) umbrella project anyway.
2016-06-10 02:54:22 +03:00
Andrew Bruce 0c94b3d87a Fix typo in node name 2016-06-09 15:49:57 +01:00
Michael Klishin d27469c665 RabbitMQ.CLI.RabbitMQCtl => RabbitMQ.CLI.Ctl, references #74 2016-06-09 04:08:21 +03:00
Michael Klishin 4e31f4c627 More renaming, references #74 2016-06-09 04:00:43 +03:00
Michael Klishin 509179402a Missing file for the previous commit 2016-06-09 03:35:11 +03:00
Michael Klishin 0c35f5a8cd Move start_distribution into RabbitMQ.CLI.Distribution 2016-06-09 02:23:10 +03:00