From dfa78447f77e1e9ba3e6add9a6e760ee7b0d0686 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 (cherry picked from commit ce98b17bf79796a2e45968d414006313fe911f39) --- 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 19c0e4a39..1d7aff606 100644 --- a/deploy/examples/create-external-cluster-resources.py +++ b/deploy/examples/create-external-cluster-resources.py @@ -768,7 +768,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 e79aca251e29d68b430b6494d92daf54107b63ed 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 (cherry picked from commit 149beedf207246d4476e8cdf0b7d7cbda2890a6f) --- 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 1d7aff606..8df878814 100644 --- a/deploy/examples/create-external-cluster-resources.py +++ b/deploy/examples/create-external-cluster-resources.py @@ -860,7 +860,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 9e2acce8a406ae54414e642cb9e70c176ca4528c 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 (cherry picked from commit b9d8df9ec9d57b220a2775847c53bd2b9b047898) --- 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 8df878814..13723aceb 100644 --- a/deploy/examples/create-external-cluster-resources.py +++ b/deploy/examples/create-external-cluster-resources.py @@ -879,6 +879,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", @@ -1083,9 +1085,6 @@ class RadosJSON: } }) - if self._arg_parser.dry_run: - return "" - return json.dumps(json_out)+LINESEP def upgrade_users_permissions(self):