From ce98b17bf79796a2e45968d414006313fe911f39 Mon Sep 17 00:00:00 2001 From: vavuthu Date: Wed, 9 Mar 2022 12:12:52 +0530 Subject: [PATCH 1/3] core: fix incorrect join command Fixing typo in join command joing -> join Signed-off-by: vavuthu --- deploy/examples/create-external-cluster-resources.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/examples/create-external-cluster-resources.py b/deploy/examples/create-external-cluster-resources.py index 8dd79d81d..a8f205336 100644 --- a/deploy/examples/create-external-cluster-resources.py +++ b/deploy/examples/create-external-cluster-resources.py @@ -775,7 +775,7 @@ class RadosJSON: cmd = ['radosgw-admin', 'user', 'create', '--uid', self.EXTERNAL_RGW_ADMIN_OPS_USER_NAME, '--display-name', 'Rook RGW Admin Ops user', '--caps', 'buckets=*;users=*;usage=read;metadata=read;zone=read'] if self._arg_parser.dry_run: - return self.dry_run("ceph " + "".joing(cmd)) + return self.dry_run("ceph " + " ".join(cmd)) try: output = subprocess.check_output(cmd, stderr=subprocess.PIPE) From 149beedf207246d4476e8cdf0b7d7cbda2890a6f Mon Sep 17 00:00:00 2001 From: vavuthu Date: Wed, 9 Mar 2022 17:34:56 +0530 Subject: [PATCH 2/3] core: assign ACCESS_KEY and SECRET_KEY values only in case of actual run When using dry-run option with external script, function create_rgw_admin_ops_user is not returning expected values which leads to TypeError. This fix is to append values to out_map dictionary only in case of actual run. Signed-off-by: vavuthu --- deploy/examples/create-external-cluster-resources.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/deploy/examples/create-external-cluster-resources.py b/deploy/examples/create-external-cluster-resources.py index a8f205336..a6df3f789 100644 --- a/deploy/examples/create-external-cluster-resources.py +++ b/deploy/examples/create-external-cluster-resources.py @@ -871,7 +871,10 @@ class RadosJSON: self.out_map['RBD_METADATA_EC_POOL_NAME'] = self.validate_rgw_metadata_ec_pool_name() self.out_map['RGW_POOL_PREFIX'] = self._arg_parser.rgw_pool_prefix if self._arg_parser.rgw_endpoint: - self.out_map['ACCESS_KEY'], self.out_map['SECRET_KEY'] = self.create_rgw_admin_ops_user() + if self._arg_parser.dry_run: + self.create_rgw_admin_ops_user() + else: + self.out_map['ACCESS_KEY'], self.out_map['SECRET_KEY'] = self.create_rgw_admin_ops_user() if self._arg_parser.rgw_tls_cert_path: self.out_map['RGW_TLS_CERT'] = self.validate_rgw_endpoint_tls_cert() From b9d8df9ec9d57b220a2775847c53bd2b9b047898 Mon Sep 17 00:00:00 2001 From: vavuthu Date: Wed, 9 Mar 2022 17:40:22 +0530 Subject: [PATCH 3/3] core: avoid creating json_out incase of dry-run When using dry-run option with external script, out_map dictionary doesn't contain keys ( ACCESS_KEY and SECRET_KEY ) which leads to KeyError. This fix to avoid creating json_out incase of dry-run since we will not use json_out for dry-run. Signed-off-by: vavuthu --- deploy/examples/create-external-cluster-resources.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/deploy/examples/create-external-cluster-resources.py b/deploy/examples/create-external-cluster-resources.py index a6df3f789..3d197e960 100644 --- a/deploy/examples/create-external-cluster-resources.py +++ b/deploy/examples/create-external-cluster-resources.py @@ -890,6 +890,8 @@ class RadosJSON: def gen_json_out(self): self._gen_output_map() + if self._arg_parser.dry_run: + return "" json_out = [ { "name": "rook-ceph-mon-endpoints", @@ -1094,9 +1096,6 @@ class RadosJSON: } }) - if self._arg_parser.dry_run: - return "" - return json.dumps(json_out)+LINESEP def upgrade_users_permissions(self):