]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/orchestractor: rgw realm and zone flags must both be provided
authorDaniel Pivonka <dpivonka@redhat.com>
Fri, 9 Apr 2021 19:25:21 +0000 (15:25 -0400)
committerSage Weil <sage@newdream.net>
Fri, 23 Apr 2021 12:24:14 +0000 (07:24 -0500)
Signed-off-by: Daniel Pivonka <dpivonka@redhat.com>
(cherry picked from commit c0803f8f271ea6b2c653b3a443f7807185303912)

src/pybind/mgr/orchestrator/module.py
src/python-common/ceph/deployment/service_spec.py

index cdf939d6be84faf21ffaa5b1a0c127eb39bbb1bb..3d4bdefdab734a01854ac57efd96eb0011c5e6c4 100644 (file)
@@ -1085,6 +1085,13 @@ Usage:
         if inbuf:
             raise OrchestratorValidationError('unrecognized command -i; -h or --help for usage')
 
+        if realm and not zone:
+            raise OrchestratorValidationError(
+                'Cannot add RGW: Realm specified but no zone specified')
+        if zone and not realm:
+            raise OrchestratorValidationError(
+                'Cannot add RGW: Zone specified but no realm specified')
+
         spec = RGWSpec(
             service_id=svc_id,
             rgw_realm=realm,
index aa3b203e0104f5e624797ae50025a3cc2dfb1dad..013e5522dcf806409069518f8f6b4e73191459f9 100644 (file)
@@ -759,6 +759,16 @@ class RGWSpec(ServiceSpec):
         else:
             return 80
 
+    def validate(self) -> None:
+        super(RGWSpec, self).validate()
+
+        if self.rgw_realm and not self.rgw_zone:
+            raise ServiceSpecValidationError(
+                    'Cannot add RGW: Realm specified but no zone specified')
+        if self.rgw_zone and not self.rgw_realm:
+            raise ServiceSpecValidationError(
+                    'Cannot add RGW: Zone specified but no realm specified')
+
 
 yaml.add_representer(RGWSpec, ServiceSpec.yaml_representer)