* change annotation of `orchestrator.Orchestrator.apply_drivegroups()` so it returns
`Sequence[Completion]`
see
https://mypy.readthedocs.io/en/latest/generics.html#variance-of-generic-types
* to follow the interface defined by `orchestrator.Orchestrator`. change
all its implementations. see `orchestrator/_interface.py`.
Signed-off-by: Kefu Chai <kchai@redhat.com>
import string
try:
- from typing import List, Dict, Optional, Callable, Tuple, TypeVar, Type, Any, NamedTuple, Iterator, Set
+ from typing import List, Dict, Optional, Callable, Tuple, TypeVar, Type, \
+ Any, NamedTuple, Iterator, Set, Sequence
from typing import TYPE_CHECKING
except ImportError:
TYPE_CHECKING = False # just for type checking
r[str(o['osd'])] = o['uuid']
return r
- def apply_drivegroups(self, specs: List[DriveGroupSpec]) -> List[orchestrator.Completion]:
+ def apply_drivegroups(self, specs: List[DriveGroupSpec]) -> Sequence[orchestrator.Completion]:
completions: List[orchestrator.Completion] = list()
for spec in specs:
completions.extend(self._apply(spec))
"""
raise NotImplementedError()
- def apply_drivegroups(self, specs: List[DriveGroupSpec]) -> List[Completion]:
+ def apply_drivegroups(self, specs: List[DriveGroupSpec]) -> Sequence[Completion]:
""" Update OSD cluster """
raise NotImplementedError()
from ceph.deployment.service_spec import NFSServiceSpec, ServiceSpec
try:
- from typing import Callable, List, Tuple
+ from typing import Callable, List, Sequence, Tuple
except ImportError:
pass # type checking
)
def apply_drivegroups(self, specs):
- # type: (List[DriveGroupSpec]) -> TestCompletion
+ # type: (List[DriveGroupSpec]) -> Sequence[TestCompletion]
drive_group = specs[0]
def run(all_hosts):
# type: (List[orchestrator.HostSpec]) -> None
if drive_group.placement.host_pattern:
if not drive_group.placement.pattern_matches_hosts([h.hostname for h in all_hosts]):
raise orchestrator.OrchestratorValidationError('failed to match')
- return self.get_hosts().then(run).then(
+ return [self.get_hosts().then(run).then(
on_complete=orchestrator.ProgressReference(
message='apply_drivesgroups',
mgr=self,
)
- )
+ )]
@deferred_write("remove_daemons")
def remove_daemons(self, names, force):