]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/orchestractor: rgw realm and zone flags must both be provided 40735/head
authorDaniel Pivonka <dpivonka@redhat.com>
Fri, 9 Apr 2021 19:25:21 +0000 (15:25 -0400)
committerDaniel Pivonka <dpivonka@redhat.com>
Mon, 12 Apr 2021 14:19:53 +0000 (10:19 -0400)
Signed-off-by: Daniel Pivonka <dpivonka@redhat.com>
src/pybind/mgr/orchestrator/module.py
src/python-common/ceph/deployment/service_spec.py

index 2e9e1f2574a3face02bc377bbbed99b3e7cd178c..036bf1d71ef9e6b168d9277f4c89ba9d1258a500 100644 (file)
@@ -1083,6 +1083,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 b42c6addbdbaa3d484499997ffd5acecd16596ff..7d413af51502298e9ce671662eca8d36b4b27ded 100644 (file)
@@ -760,6 +760,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)