Skip to content

Commit 701f256

Browse files
New command: 'policies declare_override'
an override policy is a policy with a different name, a higher priority and a tweaked definition that still has the same pattern and matches the same kind of objects. These overrides are useful when automating Blue-Green deployments [1]. 1. https://www.rabbitmq.com/docs/blue-green-upgrade
1 parent 5924ec3 commit 701f256

File tree

7 files changed

+172
-66
lines changed

7 files changed

+172
-66
lines changed

Cargo.lock

Lines changed: 49 additions & 58 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cli.rs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1775,7 +1775,7 @@ fn operator_policies_subcommands(pre_flight_settings: PreFlightSettings) -> [Com
17751775
.map(|cmd| cmd.infer_long_args(pre_flight_settings.infer_long_options))
17761776
}
17771777

1778-
fn policies_subcommands(pre_flight_settings: PreFlightSettings) -> [Command; 10] {
1778+
fn policies_subcommands(pre_flight_settings: PreFlightSettings) -> [Command; 11] {
17791779
let declare_cmd = Command::new("declare")
17801780
.visible_aliases(vec!["update", "set"])
17811781
.about("Creates or updates a policy")
@@ -1814,6 +1814,26 @@ fn policies_subcommands(pre_flight_settings: PreFlightSettings) -> [Command; 10]
18141814
.required(true),
18151815
);
18161816

1817+
let declare_override_cmd = Command::new("declare_override")
1818+
.about("Declares a new policy from an existing one, with a higher priority, and merges a set of keys into the new overriding policy definition")
1819+
.arg(
1820+
Arg::new("name")
1821+
.long("name")
1822+
.help("the name of the policy to create an override for")
1823+
.required(true),
1824+
)
1825+
.arg(
1826+
Arg::new("override_name")
1827+
.long("override-name")
1828+
.help("the name of the new overriding policy. If omitted, an 'override' suffix will be added to the original name.")
1829+
.required(false),
1830+
)
1831+
.arg(
1832+
Arg::new("definition")
1833+
.long("definition")
1834+
.help("additional definitions to merge into the new overriding policy"),
1835+
);
1836+
18171837
let list_cmd = Command::new("list")
18181838
.long_about("Lists policies")
18191839
.after_help(color_print::cformat!(
@@ -1927,6 +1947,7 @@ fn policies_subcommands(pre_flight_settings: PreFlightSettings) -> [Command; 10]
19271947

19281948
[
19291949
declare_cmd,
1950+
declare_override_cmd,
19301951
delete_cmd,
19311952
delete_definition_key_cmd,
19321953
delete_definition_key_from_all_in_cmd,

0 commit comments

Comments
 (0)