From: Daniel Pivonka Date: Fri, 9 Apr 2021 19:25:21 +0000 (-0400) Subject: mgr/orchestractor: rgw realm and zone flags must both be provided X-Git-Tag: v16.2.2~1^2~27 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1ddfb6e84e64fc52defac017ad536c9341177c08;p=ceph.git mgr/orchestractor: rgw realm and zone flags must both be provided Signed-off-by: Daniel Pivonka (cherry picked from commit c0803f8f271ea6b2c653b3a443f7807185303912) --- diff --git a/src/pybind/mgr/orchestrator/module.py b/src/pybind/mgr/orchestrator/module.py index cdf939d6be84..3d4bdefdab73 100644 --- a/src/pybind/mgr/orchestrator/module.py +++ b/src/pybind/mgr/orchestrator/module.py @@ -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, diff --git a/src/python-common/ceph/deployment/service_spec.py b/src/python-common/ceph/deployment/service_spec.py index aa3b203e0104..013e5522dcf8 100644 --- a/src/python-common/ceph/deployment/service_spec.py +++ b/src/python-common/ceph/deployment/service_spec.py @@ -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)