]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/cephadm: fix RGWSpec mypy errors
authorMichael Fritch <mfritch@suse.com>
Wed, 3 Jun 2020 20:44:30 +0000 (14:44 -0600)
committerMichael Fritch <mfritch@suse.com>
Wed, 3 Jun 2020 22:37:55 +0000 (16:37 -0600)
cephadm/module.py:34: note: In module imported here:
cephadm/services/cephadmservice.py: note: In member "config" of class "RgwService":
cephadm/services/cephadmservice.py:167: error: Incompatible types in assignment (expression has type "List[str]", variable has type "str")

Signed-off-by: Michael Fritch <mfritch@suse.com>
src/pybind/mgr/cephadm/services/cephadmservice.py

index 3755ea1b6e1688cbd0c00cd91eb54f315b47074a..6acbb60493b5ca0a90a96d6f1f1411dfeeac9cc3 100644 (file)
@@ -163,8 +163,12 @@ class RgwService(CephadmService):
         if spec.rgw_frontend_ssl_certificate:
             if isinstance(spec.rgw_frontend_ssl_certificate, list):
                 cert_data = '\n'.join(spec.rgw_frontend_ssl_certificate)
-            else:
+            elif isinstance(spec.rgw_frontend_ssl_certificate, str):
                 cert_data = spec.rgw_frontend_ssl_certificate
+            else:
+                raise OrchestratorError(
+                        'Invalid rgw_frontend_ssl_certificate: %s'
+                        % spec.rgw_frontend_ssl_certificate)
             ret, out, err = self.mgr.check_mon_command({
                 'prefix': 'config-key set',
                 'key': f'rgw/cert/{spec.rgw_realm}/{spec.rgw_zone}.crt',
@@ -174,8 +178,12 @@ class RgwService(CephadmService):
         if spec.rgw_frontend_ssl_key:
             if isinstance(spec.rgw_frontend_ssl_key, list):
                 key_data = '\n'.join(spec.rgw_frontend_ssl_key)
+            elif isinstance(spec.rgw_frontend_ssl_certificate, str):
+                key_data = spec.rgw_frontend_ssl_key
             else:
-                key_data = spec.rgw_frontend_ssl_key  # type: ignore
+                raise OrchestratorError(
+                        'Invalid rgw_frontend_ssl_key: %s'
+                        % spec.rgw_frontend_ssl_key)
             ret, out, err = self.mgr.check_mon_command({
                 'prefix': 'config-key set',
                 'key': f'rgw/cert/{spec.rgw_realm}/{spec.rgw_zone}.key',