From 51ff52ba0abb5721657723b3d241deb1eb716535 Mon Sep 17 00:00:00 2001 From: David Ansari Date: Mon, 15 Aug 2022 08:24:35 +0000 Subject: [PATCH] Simplify CLI command to enable feature flags Since we bumped the minimum supported RabbitMQ version to v3.9.0 in https://github.com/rabbitmq/cluster-operator/pull/1110, we can use the CLI command `rabbitmqctl enable_feature_flag all` introduced in https://github.com/rabbitmq/rabbitmq-server/commit/ce655864050a78f46005b8aa5e047394a6178cd6. --- controllers/reconcile_cli.go | 2 +- controllers/reconcile_cli_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/reconcile_cli.go b/controllers/reconcile_cli.go index c0867e854..11c449773 100644 --- a/controllers/reconcile_cli.go +++ b/controllers/reconcile_cli.go @@ -68,7 +68,7 @@ func (r *RabbitmqClusterReconciler) runRabbitmqCLICommandsIfAnnotated(ctx contex func (r *RabbitmqClusterReconciler) runEnableFeatureFlagsCommand(ctx context.Context, rmq *rabbitmqv1beta1.RabbitmqCluster, sts *appsv1.StatefulSet) error { logger := ctrl.LoggerFrom(ctx) podName := fmt.Sprintf("%s-0", rmq.ChildResourceName("server")) - cmd := "set -eo pipefail; rabbitmqctl -s list_feature_flags name state stability | (grep 'disabled\\sstable$' || true) | cut -f 1 | xargs -r -n1 rabbitmqctl enable_feature_flag" + cmd := "rabbitmqctl enable_feature_flag all" stdout, stderr, err := r.exec(rmq.Namespace, podName, "rabbitmq", "bash", "-c", cmd) if err != nil { msg := "failed to enable all feature flags on pod" diff --git a/controllers/reconcile_cli_test.go b/controllers/reconcile_cli_test.go index b271243e1..f895a291a 100644 --- a/controllers/reconcile_cli_test.go +++ b/controllers/reconcile_cli_test.go @@ -60,7 +60,7 @@ var _ = Describe("Reconcile CLI", func() { return sts.ObjectMeta.Annotations }, 5).ShouldNot(HaveKey("rabbitmq.com/createdAt")) Expect(fakeExecutor.ExecutedCommands()).To(ContainElement(command{"bash", "-c", - "set -eo pipefail; rabbitmqctl -s list_feature_flags name state stability | (grep 'disabled\\sstable$' || true) | cut -f 1 | xargs -r -n1 rabbitmqctl enable_feature_flag"})) + "rabbitmqctl enable_feature_flag all"})) }) }) })