Luke Bakken
1d878c79e1
Fix merge defaults test, fix warnings
2018-11-30 14:48:47 -08:00
Luke Bakken
c8e766dec7
Add function to normalise :node option after distribution started
...
Fixes #278
2018-11-30 07:00:18 -08:00
Luke Bakken
8ab22299a8
Document --no-table-headers
...
Fixes #274
Switch no_table_headers to table_headers
update tests
Integrate --silent
2018-11-19 15:25:36 -08:00
Ayanda Dube
c88cfd940d
Reduce code footprint on aliases
2018-07-23 06:06:18 +01:00
Daniil Fedotov
b5de2236ce
Add a callback to control erlang distribution.
...
The callback cab be used to disable distribution (offline commands)
or to have command-specific node name and distribution parameters.
2017-12-06 18:10:11 +00:00
Daniil Fedotov
32cf46e5c8
Fix rabbitmq-plugins enable/disable/set behavior for --online flag.
...
If flag is set to `--online` the commands should fail if node is not
running.
If flag is not set, they should fallback to offline mode if the
node is not running.
This corresponds to the rabbitmq-plugins.8 manpage.
Made validation aware of online flag.
Define best_effort mode to fallback if node is not running.
Requires rabbitmq/rabbitmq-server#1433
Fixes #226
[#153184802 ]
2017-11-27 18:49:08 +00:00
Daniil Fedotov
e34bfe2297
Merge branch 'master' into rabbitmq-cli-214-take-two
2017-08-14 14:40:35 +01:00
Daniil Fedotov
568874033d
Run dialyzer tests. Fix warnings.
...
Some types were named wrongly (list(), map())
MapSet cannot be matched to be empty. `%MapSet{}` only matches the type.
2017-08-14 14:36:38 +01:00
Luke Bakken
cb65a340d5
Add single quotes around commands given in output
2017-08-11 17:00:20 -07:00
Michael Klishin
6b007ab1cf
Make sure we format errors here
2017-08-11 18:04:00 +03:00
Michael Klishin
efe8725f3c
Merge branch 'master' into rabbitmq-cli-214-take-two
2017-08-10 14:21:42 +03:00
Michael Klishin
2eda5ea31c
Make sure *validation_error_output/2 functions are used correctly
2017-08-09 15:52:04 +03:00
Michael Klishin
0031c4fdf6
Make validate/2 and validate_execution_environment/2 use the same tuple tag
...
Per discussion with @hairyhum.
2017-08-09 01:11:14 +03:00
Michael Klishin
c227843e32
Make validate_execution_environment/2 use a different tuple tag for failures
...
Per discussion with @hairyhum.
2017-08-08 18:29:04 +03:00
Diana Corbacho
9d6dfddb3e
Set a timeout on list_queues and a warning if unresponsive ones are found
...
Related to rabbitmq-cli#207
2017-08-07 17:38:24 +02:00
Michael Klishin
8e9b114eac
Fold execution environment validation into a single optional fn
...
While at it, move Ctl.Validators => Core.Validators.
If the function is not defined we skip validation. Note that
individual commands need to be revisited and refactored to use
this mechanism; this is yet to come.
Per discussion with @hairyhum and @lukebakken.
2017-08-04 18:40:17 +03:00
Michael Klishin
d92b78b49e
Simplify, explain
2017-08-04 15:20:57 +03:00
Michael Klishin
032482cec6
Factor in rabbit app state and execution env validation
...
This introduces two other "validation steps" that have little or nothing
to do with CLI argument validation.
Per discussion with @hairyhum.
2017-08-04 15:08:37 +03:00
Michael Klishin
9919700303
Inline validate_and_run_command/3 for greater flexibility
...
This way we can inject more "validation steps" between validate/2
return and command execution, such as checking whether the rabbit app
is running (or not running) on the remote node.
While at it, group functions that are used in a chain.
2017-08-04 14:09:37 +03:00
Michael Klishin
a33b26105c
Supress banners for machine readable format
...
Namely JSON and CSV.
Fixes #205 .
2017-07-14 18:08:17 +03:00
Michael Klishin
3f21e0fac1
Make sure that command-provided defaults are available to output formatting fns
2017-07-13 15:46:31 +03:00
Michael Klishin
310ffe159e
Wording
2017-07-04 22:41:32 +03:00
Michael Klishin
ca20f8a0d6
Make CLI tools diagnostics message more detailed
...
Our current message is informative enough but it ends with a "nodedown".
Emperical evidence suggests that once a user sees it, they stop reading.
Providing a hint that there will be diagnostics output below is step 1.
Step 2 is improving the diagnostics section. It now
* Calls out three most common groups of issues explicitly
* Suggests what documentation guides can contain helpful information
There are rabbitmq-server and rabbitmq-common commits that make
similar improvements to the server-supplied part of the diagnostics
message.
Per discussion with the team.
2017-07-04 22:34:39 +03:00
Michael Klishin
88629421d1
Whitespace
2017-06-30 14:44:35 +03:00
Michael Klishin
b7b5223a39
list_vhost_limits: handle errors before serialising results
...
Also update tests and format no_such_vhost errors in a more sensible
way.
2017-06-30 14:43:09 +03:00
Michael Klishin
31822baf8c
Revert "Revert "Compile""
...
This reverts commit 7908b17f01
.
Test failures were due to something tripping up test node start,
not the change in ec695461ab
.
2017-06-16 17:55:31 +03:00
Michael Klishin
7908b17f01
Revert "Compile"
...
This reverts commit ec695461ab
.
This introduced test failures.
2017-06-16 17:35:57 +03:00
Michael Klishin
ec695461ab
Compile
2017-06-16 17:34:29 +03:00
Diana Corbacho
cb2b3bc667
Fix timed out message
2017-06-16 14:54:33 +01:00
Diana Corbacho
dfa9827135
Use the output of multirpc to report the down or timed out nodes
...
Most commands do rpc's only to the target node, but join_cluster
triggers an rpc between nodes. If the rpc to the remote down returns
down/timeout, we must use that value to run the diagnostics.
Using the node from command options in diagnostics will report as down
the wrong node.
rabbitmq-cli#197
2017-06-16 12:41:11 +01:00
Daniil Fedotov
1641ecbc11
Improve wait command.
...
Do not call await_startup on rabbitmq node, instead do it on
rabbitmqctl node, so even if net_ticktime is low, it won't fail
with nodedown.
2017-06-08 18:15:21 +01:00
Daniil Fedotov
b802fcdf87
Do not try to connect to the RabbitMQ node before executing command
...
Commands are supposed to return bardpc errors, which are handled by output,
so there is no need to connect to the node before calling the run function.
2017-06-07 16:21:53 +01:00
Daniil Fedotov
61eeab17c1
Callback for exec_command function to process output
2017-06-06 12:07:34 +01:00
Daniil Fedotov
769fe8e712
Better error management with stream outputs from list_ commands.
...
Fixed incorrect tuple matching.
Added support for error codes and messages for timeout with value.
2017-05-24 13:28:51 +01:00
Daniil Fedotov
60deb8514d
Improve error reporting.
...
badrpc errors are handled in Rabbitmqctl module.
Report errors from node discovery
Add helpers to skip errors in formatters.
2017-05-24 12:08:03 +01:00
Daniil Fedotov
8ef4c404ab
Do not import modules. Import only protocols and records.
...
Aliases is a convinient enough to reference elixir modules.
Imported functions can be confusing, especially mixed with aliases.
2017-04-05 11:59:54 +01:00
Daniil Fedotov
819d512038
Implement shutdown command
2017-04-04 19:23:50 +01:00
Daniil Fedotov
62a44ac641
Optimize rabbitmqctl startup.
...
Plugins dirs are added to ERL_LIBS by shell scripts, we try to load
enabled plugins first and scan plugins dir only if some of them
are not found.
When discovering plugins, we can load applications only for enabled ones.
EPMD can be started only after initial `net_kernel:start` call failed.
We don't need to discover all commands every time, only if a command is not
in the `rabbitmqctl` application modules.
[finishes #143025009 ]
2017-04-04 14:06:53 +01:00
Daniil Fedotov
04c1c2e2f9
Do not print "Command '' not found" for empty command
2017-01-25 15:24:47 +00:00
Daniil Fedotov
a5857e13d8
Handle auto-completion line as argv, not a single argument
...
It's easier to detect a script name if passed as argv list.
Arguments can be parsed with quoted spaces (e.g. in directory path)
2017-01-24 14:40:31 +00:00
Daniil Fedotov
3871c4ccde
Support autocompletion with different script names
2017-01-24 12:30:12 +00:00
Daniil Fedotov
6288d75472
Cleanup compiler warnings
2017-01-24 09:59:00 +00:00
Daniil Fedotov
2174446ff9
Auto complete command called with full path
2017-01-24 09:47:30 +00:00
Michael Klishin
cbab77e34c
Fix --auto-complete clauses
...
According to the completion script in rabbitmq/rabbitmq-server-release#14 , the correct
way to invoke auto-completion is
/path/to/rabbitmqctl --auto-complete [command prefix]
However, the above arguments were not matched by the existing
main heads.
2017-01-21 23:33:35 +03:00
Jean-Sébastien Pédron
5905f1c40a
Update copyright line to year 2017
2017-01-10 15:42:40 +01:00
Daniil Fedotov
30b41ba267
Support start from common_test tests
2016-12-23 12:12:33 +00:00
Daniil Fedotov
fc0ca12a91
Test commands suggestions
2016-12-06 12:19:25 +00:00
Daniil Fedotov
80dc953ee5
Suggest commands by Levenshtein distance
2016-12-05 18:59:58 +00:00
Michael Klishin
cb41fe932d
Unbreak with_distribution/1
2016-12-05 19:23:20 +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
Daniil Fedotov
c62d48380a
Load command specific options from a single command
2016-11-30 16:51:59 +00: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
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
Daniil Fedotov
36ac65d56a
Remove dependencies
2016-11-15 16:14:22 +00:00
Daniil Fedotov
ccb6bf116c
Namespace refactoring
2016-11-14 17:52:08 +00:00
Daniil Fedotov
1dc8e90a70
Make tests happy
2016-11-10 17:40:43 +00:00
Daniil Fedotov
3c8e6d1ef7
Use seconds in timeout parameter. Better timeout error report
2016-11-10 14:53:59 +00:00
Daniil Fedotov
ad90e60121
script name is overridable via argument
2016-11-08 14:21:31 +00:00
Daniil Fedotov
b98470288d
List plugins formatter
2016-11-08 14:19:11 +00:00
Daniil Fedotov
85d6868763
Make table formatter look like in the old CLI
2016-11-04 12:38:35 +00:00
Daniil Fedotov
dcd831ec99
Correct IO device name
2016-11-04 11:12:14 +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
4c13a51ac8
Reworking command outputs
2016-08-22 12:58:37 +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
1d911b4350
Delete a duplicate fn head
2016-08-14 08:07:19 +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
0449004a6b
Merge branch 'master' into rabbitmq-cli-change-cluster-node-type
2016-08-12 01:04:01 +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
Daniil Fedotov
6f3f0854bd
Rename auto complete option for consistency
2016-08-10 18:19:06 +01: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
a06a4321d6
merge_defaults_defaults => merge_all_defaults
2016-08-08 21:46:47 +03:00
Daniil Fedotov
4d40649d44
Command auto completion
2016-07-28 17:46:37 +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
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
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
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
Michael Klishin
506c9cc43f
Normalize node names before passing them to Command.run/2
...
Fixes #76 .
2016-06-10 00:56:44 +03: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
8fcad8338e
Namespace more modules under RabbitMQ.CLI, part of #74
2016-06-09 03:34:56 +03:00
Michael Klishin
0c35f5a8cd
Move start_distribution into RabbitMQ.CLI.Distribution
2016-06-09 02:23:10 +03:00
Michael Klishin
3a2b277d4f
Squash a warning
2016-06-09 00:42:51 +03:00
Daniil Fedotov
091105e5b0
0 arity start_distribution
2016-06-08 17:04:08 +01:00
Daniil Fedotov
9b703b2896
Dynamically select distribution node
2016-06-08 15:19:37 +01:00
Jean-Sébastien Pédron
1b1534f86b
Implement the `join_cluster` command
...
Compared to the Erlang-based rabbitmqctl's command, this one accepts
`--disc` to specify the node type. In the implementation, it does
nothing because that's the default value already. It is only to improve
consistency, because there is a `--ram` flag.
The testsuite for this command is incomplete in this commit. When a
testcase will be able to start and stop multiple nodes, the testsuite
will need to be completed.
[#116551629 ]
2016-06-06 16:06:52 +02:00
Jean-Sébastien Pédron
9349c9bf07
Improve "Please stop the node with rabbitmqctl stop_app" message
...
... with "Please stop RabbitMQ with rabbitmqctl stop_app".
The previous message didn't make sense: `stop_app` only stop the
RabbitMQ application, not the entire node (which we don't want to do in
the context of this message).
2016-06-06 16:00:50 +02:00
kjnilsson
43ae69a06d
Implement wait command
2016-06-02 16:03:54 +01:00
kjnilsson
dec08906fa
Implement reset and force_reset commands
2016-06-02 11:55:10 +01:00
Michael Klishin
be84eb1e96
Handle node healthcheck failures
2016-06-02 01:38:09 +03:00
kjnilsson
715f691b8e
avoid connecting to rabbitmq before executing help command
...
avoid printing a nil banner
2016-05-31 09:40:48 +01:00
Michael Klishin
c8f36766b2
Don't fail with undef when printing command usage info with invalid CLI arguments
2016-05-30 02:16:10 +03:00
Michael Klishin
17f6c10f6b
Cosmetics
2016-05-30 02:06:52 +03:00