flags: Inject __class__ attribute to LooseVersion
Currently, ryu-manager uses distutils.version.LooseVersion for "--zapi-frr-version" to parse the given version sting. With custom type class for oslo_config.cfg.Opt, oslo_config might access __class__ attribute for equal comparison. But in case on Python 2, LooseVersion does not have __class__ attribute and it causes AttributeError. (This error is not always reproduced) This patch injects required attribute into LooseVersion and avoids this problem. Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
eda4940eb8
commit
5bde6ae440
@ -86,6 +86,13 @@ DEFAULT_ZSERV_ROUTER_ID = '1.1.1.1'
|
||||
# should be None.
|
||||
DEFAULT_ZSERV_FRR_VERSION = '0.0'
|
||||
|
||||
# Hack: In oslo_config.cfg.Opt, ConfigType might access __class__ attribute
|
||||
# for equal comparison, but on Python 2, LooseVersion does not have __class__
|
||||
# attribute and it causes AttributeError. So here inject __class__ attribute
|
||||
# into LooseVersion class.
|
||||
if not hasattr(LooseVersion, '__class__'):
|
||||
LooseVersion.__class__ = LooseVersion
|
||||
|
||||
CONF.register_cli_opts([
|
||||
cfg.StrOpt(
|
||||
'server-host', default=DEFAULT_ZSERV_HOST,
|
||||
|
Loading…
Reference in New Issue
Block a user