]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/rook: fix some mypy typing errors in rook_cluster.py
authorJoseph Sawaya <jsawaya@redhat.com>
Tue, 15 Jun 2021 22:07:51 +0000 (18:07 -0400)
committerSage Weil <sage@newdream.net>
Thu, 17 Jun 2021 13:16:05 +0000 (09:16 -0400)
This commit fixes some errors caught by mypy in rook_cluster.py. Most of the
errors were caused by the update of the rook-client-python submodule in a previous
commit.

Signed-off-by: Joseph Sawaya <jsawaya@redhat.com>
src/pybind/mgr/rook/rook_cluster.py

index b78c19b1f146ebd2c466cfa266e56d429fa5278c..dddc05893cad574b609a1d7c29866872c296e59d 100644 (file)
@@ -414,6 +414,8 @@ class RookCluster(object):
                     namespace=self.rook_env.namespace,
                 ),
                 spec=cfs.Spec(
+                    None,
+                    None,
                     metadataServer=cfs.MetadataServer(
                         activeCount=spec.placement.count or 1,
                         activeStandby=True
@@ -468,9 +470,13 @@ class RookCluster(object):
                 
 
         def _update_zone(new: cos.CephObjectStore) -> cos.CephObjectStore:
-            new.spec.gateway.instances = spec.placement.count or 1
+            if new.spec.gateway:
+                new.spec.gateway.instances = spec.placement.count or 1
+            else: 
+                new.spec.gateway=cos.Gateway(
+                    instances=spec.placement.count or 1
+                )
             return new
-
         return self._create_or_patch(
             cos.CephObjectStore, 'cephobjectstores', name,
             _update_zone, _create_zone)
@@ -495,6 +501,7 @@ class RookCluster(object):
                         ),
                     spec=cnfs.Spec(
                         rados=cnfs.Rados(
+                            namespace=self.rook_env.namespace,
                             pool=spec.pool
                             ),
                         server=cnfs.Server(
@@ -565,6 +572,8 @@ class RookCluster(object):
             # FIXME: this is all not really atomic, because jsonpatch doesn't
             # let us do "test" operations that would check if items with
             # matching names were in existing lists.
+            if not new_cluster.spec.storage:
+                raise orchestrator.OrchestratorError('new_cluster missing storage attribute')
 
             if not hasattr(new_cluster.spec.storage, 'nodes'):
                 new_cluster.spec.storage.nodes = ccl.NodesList()
@@ -575,7 +584,10 @@ class RookCluster(object):
             if matching_host not in [n.name for n in current_nodes]:
                 pd = ccl.NodesItem(
                     name=matching_host,
-                    config=ccl.Config(
+                    # config=ccl.Config(
+                    #     storeType=drive_group.objectstore
+                    # )
+                    config=object(  
                         storeType=drive_group.objectstore
                     )
                 )