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: v17.1.0~2264^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F40735%2Fhead;p=ceph.git mgr/orchestractor: rgw realm and zone flags must both be provided Signed-off-by: Daniel Pivonka --- diff --git a/src/pybind/mgr/orchestrator/module.py b/src/pybind/mgr/orchestrator/module.py index 2e9e1f2574a3..036bf1d71ef9 100644 --- a/src/pybind/mgr/orchestrator/module.py +++ b/src/pybind/mgr/orchestrator/module.py @@ -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, diff --git a/src/python-common/ceph/deployment/service_spec.py b/src/python-common/ceph/deployment/service_spec.py index b42c6addbdba..7d413af51502 100644 --- a/src/python-common/ceph/deployment/service_spec.py +++ b/src/python-common/ceph/deployment/service_spec.py @@ -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)