Skip to content

Commit

Permalink
mgr/cephadm: init attrs created by settattr()
Browse files Browse the repository at this point in the history
to address the test falure caused by mypy:
```
mypy run-test: commands[0] | mypy --config-file=../../mypy.ini ansible/module.py cephadm/module.py mgr_module.py mgr_util.py orchestrator.py orchestrator_cli/module.py rook/module.py
test_orchestrator/module.py
cephadm/module.py: note: In member "_check_for_strays" of class "CephadmOrchestrator":
cephadm/module.py:596: error: "CephadmOrchestrator" has no attribute "warn_on_stray_hosts"
cephadm/module.py:596: error: "CephadmOrchestrator" has no attribute "warn_on_stray_services"
cephadm/module.py:599: error: "CephadmOrchestrator" has no attribute "warn_on_stray_services"
Found 3 errors in 1 file (checked 8 source files)
```
see also python/mypy#5719

Signed-off-by: Kefu Chai <kchai@redhat.com>
  • Loading branch information
tchaikov committed Jan 29, 2020
1 parent ec2e53f commit 1829a1e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/pybind/mgr/cephadm/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,15 @@ def __init__(self, *args, **kwargs):
super(CephadmOrchestrator, self).__init__(*args, **kwargs)
self._cluster_fsid = self.get('mon_map')['fsid']

# for mypy which does not run the code
self.ssh_config_file = None # type: Optional[str]
self.inventory_cache_timeout = 0
self.service_cache_timeout = 0
self.mode = ''
self.container_image_base = ''
self.warn_on_stray_hosts = True
self.warn_on_stray_services = True

# for serve()
self.run = True
self.event = Event()
Expand Down

0 comments on commit 1829a1e

Please sign in to comment.