Don't import module "etcd3gw" if etcd3gw backend is not used.
If module etcd3gw is not required for used backend, then no need to have it installed and imported. Otherwise we always have ugly log error: Could not load 'oslo_cache.etcd3gw': No module named 'etcd3gw': ModuleNotFoundError: No module named 'etcd3gw Closes-Bug: 1928318 Change-Id: Icbe6dc3e93b4d2fec1ceb88366027294e49d7032 (cherry picked from commit40946a9349
) (cherry picked from commit3df5e90013
) (cherry picked from commitf0ddb8a63f
)
This commit is contained in:
parent
708f7ebdad
commit
978a093b23
|
@ -16,7 +16,6 @@
|
|||
|
||||
from __future__ import absolute_import
|
||||
from dogpile.cache import api
|
||||
import etcd3gw
|
||||
|
||||
from oslo_cache import core
|
||||
from oslo_serialization import jsonutils
|
||||
|
@ -42,6 +41,8 @@ class Etcd3gwCacheBackend(api.CacheBackend):
|
|||
self.host = arguments.get('host', self.DEFAULT_HOST)
|
||||
self.port = arguments.get('port', self.DEFAULT_PORT)
|
||||
self.timeout = int(arguments.get('timeout', self.DEFAULT_TIMEOUT))
|
||||
# module etcd3gw is only required when etcd3gw backend is used
|
||||
import etcd3gw
|
||||
self._client = etcd3gw.client(host=self.host,
|
||||
port=self.port,
|
||||
timeout=self.timeout)
|
||||
|
|
Loading…
Reference in New Issue