Skip to content

Commit 9c8ecf7

Browse files
0.27.0
1 parent dfcc5f4 commit 9c8ecf7

File tree

6 files changed

+67
-26
lines changed

6 files changed

+67
-26
lines changed

CHANGELOG.md

+24-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,33 @@
11
# rabbitmqadmin-ng Change Log
22

3-
## v0.27.0 (in development)
3+
## v0.28.0 (in development)
44

55
No changes yet.
66

77

8+
## v0.27.0 (Mar 10, 2025)
9+
10+
### Enhancements
11+
12+
* `definitions export` now supports a new flag, `--transformations`, a comma-separated list of
13+
supported operations to apply to the definitions.
14+
15+
```shell
16+
rabbitmqadmin definitions export --transformations strip_cmq_keys_from_policies,drop_empty_policies
17+
```
18+
19+
The command above applies two transformations named `strip_cmq_keys_from_policies` and `drop_empty_policies`
20+
that will strip all classic queue mirroring-related policy keys that RabbitMQ 3.13 nodes supported,
21+
then removes policies that did not have any other keys (ended up having an empty definition).
22+
23+
* When `--non-interactive` mode is used, newlines in table cells are now replaced with comma-separated lists
24+
25+
### Bug Fixes
26+
27+
* 'declare queue's `--type` flag value that the tool does not recognize are now passed as is to
28+
the HTTP API
29+
30+
831
## v0.26.0 (Mar 3, 2025)
932

1033
### Enhancements

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rabbitmqadmin"
3-
version = "0.26.0"
3+
version = "0.27.0"
44
edition = "2024"
55

66
description = "rabbitmqadmin v2 is a major revision of rabbitmqadmin, one of the RabbitMQ CLI tools that target the HTTP API"

src/cli.rs

+13-12
Original file line numberDiff line numberDiff line change
@@ -1271,12 +1271,13 @@ fn export_subcommands() -> [Command; 1] {
12711271
.help("output path")
12721272
.required(false)
12731273
.default_value("-"),
1274-
).arg(
1275-
Arg::new("transformations")
1276-
.long("transformations")
1277-
.short('t')
1278-
.long_help(
1279-
r#"
1274+
)
1275+
.arg(
1276+
Arg::new("transformations")
1277+
.long("transformations")
1278+
.short('t')
1279+
.long_help(
1280+
r#"
12801281
A comma-separated list of names of the definition transformations to apply.
12811282
12821283
Supported transformations:
@@ -1286,12 +1287,12 @@ Supported transformations:
12861287
12871288
Example use: --transformations strip_cmq_keys_from_policies,drop_empty_policies
12881289
"#,
1289-
)
1290-
.num_args(1..)
1291-
.value_delimiter(',')
1292-
.action(ArgAction::Append)
1293-
.required(false),
1294-
);
1290+
)
1291+
.num_args(1..)
1292+
.value_delimiter(',')
1293+
.action(ArgAction::Append)
1294+
.required(false),
1295+
);
12951296
[definitions]
12961297
}
12971298

src/commands.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ use rabbitmq_http_client::commons::{ExchangeType, SupportedProtocol};
2121
use rabbitmq_http_client::commons::{PolicyTarget, VirtualHostLimitTarget};
2222
use rabbitmq_http_client::commons::{ShovelAcknowledgementMode, UserLimitTarget};
2323
use rabbitmq_http_client::requests::{
24-
Amqp091ShovelDestinationParams, Amqp091ShovelParams, Amqp091ShovelSourceParams,
2524
Amqp10ShovelDestinationParams, Amqp10ShovelParams, Amqp10ShovelSourceParams,
25+
Amqp091ShovelDestinationParams, Amqp091ShovelParams, Amqp091ShovelSourceParams,
2626
EnforcedLimitParams,
2727
};
2828
use std::fs;

tests/definitions_export_tests.rs

+27-10
Original file line numberDiff line numberDiff line change
@@ -47,31 +47,48 @@ fn test_export_vhost_definitions() -> Result<(), Box<dyn std::error::Error>> {
4747
}
4848

4949
#[test]
50-
fn test_export_cluster_wide_definitions_with_transformations_case1() -> Result<(), Box<dyn std::error::Error>> {
50+
fn test_export_cluster_wide_definitions_with_transformations_case1()
51+
-> Result<(), Box<dyn std::error::Error>> {
5152
let vh = "test_export_cluster_definitions.transformations.1";
5253
delete_vhost(vh).expect("failed to delete a virtual host");
5354
run_succeeds(["declare", "vhost", "--name", vh]);
5455

5556
let p1 = "test_export_cluster_definitions.1";
5657
run_succeeds([
57-
"--vhost", vh,
58-
"declare", "policy",
59-
"--name", p1,
60-
"--pattern", "^matching\\..+", "--apply-to", "classic_queues", "--priority", "10",
61-
"--definition", "{\"max-length\": 10}"]);
58+
"--vhost",
59+
vh,
60+
"declare",
61+
"policy",
62+
"--name",
63+
p1,
64+
"--pattern",
65+
"^matching\\..+",
66+
"--apply-to",
67+
"classic_queues",
68+
"--priority",
69+
"10",
70+
"--definition",
71+
"{\"max-length\": 10}",
72+
]);
6273

6374
let q = "qq.test_export_cluster_definitions.1";
6475
run_succeeds([
6576
"-V", vh, "declare", "queue", "--name", q, "--type", "quorum",
6677
]);
6778

68-
run_succeeds(["--vhost", vh, "definitions", "export"])
69-
.stdout(predicate::str::contains(p1));
79+
run_succeeds(["--vhost", vh, "definitions", "export"]).stdout(predicate::str::contains(p1));
7080
// These two cannot be tested on 4.x: empty definitions will be rejected
7181
// by validation and CMQ keys are no longer recognized as known/valid.
7282
// But at least we can test the code path this way.
73-
run_succeeds(["--vhost", vh, "definitions", "export", "--transformations", "strip_cmq_keys_from_policies,drop_empty_policies"])
74-
.stdout(predicate::str::contains(p1));
83+
run_succeeds([
84+
"--vhost",
85+
vh,
86+
"definitions",
87+
"export",
88+
"--transformations",
89+
"strip_cmq_keys_from_policies,drop_empty_policies",
90+
])
91+
.stdout(predicate::str::contains(p1));
7592

7693
delete_vhost(vh).expect("failed to delete a virtual host");
7794

0 commit comments

Comments
 (0)