Comment 2 for bug 1262148

Revision history for this message
Lianhao Lu (lianhao-lu) wrote :

I dig into this a little bit.

The config.generator works by first importing all the python modules, then for each imported python module, it will try to find all the CfgOpt options in it and print it.

During the finding process, the config.generator._guess_groups() will try to find if the CfgOpt is belonging to the 'DEFAULT' group or other groups, this is where the error happens.

The reason behind this is that "keystoneclient.middleware.auth_token" imports "keystoneclient.openstack.common.memorycache" which registers an option "memcached_servers". Later, when importing "nova.openstack.common.memorycache" which also has the same option "memcached_servers" , that option is never registered because we already have the same option from keystoneclient registered.

When the config.generator "_guess_groups()" the option "memcached_servers" from "nova.openstack.common.memorycache", it uses operator '==' to compare if two options are the same. But the oslo.cfg.Opt class doesn't implement the __eq__ method, it only implements the __ne__ method. That's why the '==' operator doesn't give us the expected result.

We should implement the __eq__ method in oslo.cfg. Before that, we should use 'not a == b' in the config.generator as a temporary workaround.