no such option oslo_messaging_metrics in group [DEFAULT]

Bug #1980652 reported by Arnaud Morin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.messaging
Invalid
Undecided
Unassigned

Bug Description

I used to use olso.messaging to target some RPC calls on some neutron agents.

It does not work with oslo.messaging >12.8.0
12.8.0 is OK
12.9.0 is KO

Involved commit is: https://github.com/openstack/oslo.messaging/commit/bdbb6d62ee20bfd5ffc59f8772a5a0e60614ba90#

Raises:
oslo_config.cfg.NoSuchOptError: no such option oslo_messaging_metrics in group [DEFAULT]

Some example code:

```python
#!/opt/openstack/neutron/bin/python3

from oslo_config import cfg
from oslo_messaging.rpc import transport
from oslo_messaging.rpc.client import RPCClient
from oslo_messaging.target import Target

conf = cfg.ConfigOpts()
conf([], default_config_files=['/etc/neutron/neutron.conf'])

ts = transport.get_rpc_transport(conf)
target = Target(topic='l3_agent.snat251943.9000.dev.cloud.ovh.net')
client = RPCClient(ts, target, retry=None, timeout=10)
client.call({}, 'oslo_rpc_server_ping')
```

```bash
$ pip freeze | grep oslo
oslo.cache==1.33.3
oslo.concurrency==3.29.1
oslo.config==8.8.0
oslo.context==2.22.1
oslo.db==4.45.0
oslo.i18n==3.23.1
oslo.log==3.42.3
oslo.messaging==12.9.0
oslo.metrics==0.4.0
oslo.middleware==3.37.1
oslo.policy==2.1.1
oslo.privsep==1.32.1
oslo.reports==1.29.2
oslo.rootwrap==5.15.2
oslo.serialization==2.28.2
oslo.service==1.38.0
oslo.upgradecheck==0.2.1
oslo.utils==4.1.0
oslo.versionedobjects==1.35.1
```

Revision history for this message
Arnaud Morin (arnaud-morin) wrote :

I was able to mitigate this by using conffixture:

from oslo_messaging.conffixture import ConfFixture

...
ConfFixture(conf)

but that seems overkill to me

Revision history for this message
Johannes Kulik (jkulik) wrote (last edit ):

Using `cfg.CONF` instead of `cfg.ConfigOpts()` and `default_config_dirs` instead of `default_config_files` fixed it for me without the need for `ConfFixture`.

Revision history for this message
Takashi Kajinami (kajinamit) wrote :

As suggested above, use the cfg.CONF singleton. The problem you see is caused by the fact that you are creating a different instance and you didn't register all the options needed. If you use the singleton then options should be registered when a relevant modules are loaded.

Changed in oslo.messaging:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.