From 50931bf872e595d7c23202bff0e67c5c20215e01 Mon Sep 17 00:00:00 2001 From: Sanskar Garg Date: Thu, 25 Jul 2024 15:03:34 +0000 Subject: [PATCH] [#23273] yugabyted: Fix `yugabyted configure_read_replica` commands. Summary: * Added checks to `yugabyted configure_read_replica` commands to check if `: is provided in the `--data_placement_constraint` flag. Jira: DB-12201 Test Plan: ./yb_build.sh --java-test 'org.yb.yugabyted.*' Reviewers: nikhil Reviewed By: nikhil Subscribers: yugabyted-dev, sgarg-yb Differential Revision: https://phorge.dev.yugabyte.com/D36842 --- bin/yugabyted | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/bin/yugabyted b/bin/yugabyted index 670ebc64e338..54bf745ada89 100755 --- a/bin/yugabyted +++ b/bin/yugabyted @@ -6864,6 +6864,8 @@ class ControlScript(object): data_constraints = args.data_placement_constraint.split(",") has_errors = False for constraint in data_constraints: + if ':' not in constraint: + has_errors = True cloud_info = constraint.split(":")[0].split(".") if (len(cloud_info) == 3): for value in cloud_info: @@ -6875,8 +6877,8 @@ class ControlScript(object): if has_errors: Output.print_out(Output.make_red("ERROR") + ": Incorrect value specified for --data_placement_constraint. " + - "Please specify comma sperated value with format " + - "- cloudprovider.region.zone") + "Please specify comma sperated values with the num of replicas with " + + "format - :") else: self.configs.temp_data[ "rr_data_placement_constraint"] = args.data_placement_constraint @@ -6900,6 +6902,8 @@ class ControlScript(object): data_constraints = args.data_placement_constraint.split(",") has_errors = False for constraint in data_constraints: + if ':' not in constraint: + has_errors = True cloud_info = constraint.split(".") if (len(cloud_info) == 3): for value in cloud_info: @@ -6911,9 +6915,8 @@ class ControlScript(object): if has_errors: Output.print_out( "Incorrect value specified for --data_placement_constraint. " + - "Please specify comma sperated value with format " + - "- cloudprovider.region.zone".format( - args.data_placement_constraint)) + "Please specify comma sperated values with the num of replicas with " + + "format - :") else: self.configs.temp_data[ "rr_data_placement_constraint"] = args.data_placement_constraint