Trivial: use condition instead of try/except
When getting a service's config, stop using try/except to tell if the conf exists, and instead use a cleaner `if hasattr`. Change-Id: Ib98ff29a38dfaaeff144958c3e0ac3c141429ba9
This commit is contained in:
parent
12eca6f75e
commit
345b440b2b
@ -80,9 +80,8 @@ class ServiceManager(SSHClient):
|
||||
whitebox-<service> config section.
|
||||
"""
|
||||
super(ServiceManager, self).__init__(hostname)
|
||||
try:
|
||||
conf = getattr(CONF, 'whitebox-%s' % service)
|
||||
except AttributeError:
|
||||
conf = getattr(CONF, 'whitebox-%s' % service, None)
|
||||
if conf is None:
|
||||
raise exceptions.MissingServiceSectionException(service=service)
|
||||
self.config_path = getattr(conf, 'config_path', None)
|
||||
self.restart_command = getattr(conf, 'restart_command', None)
|
||||
|
Loading…
Reference in New Issue
Block a user