conf get opt failed when group is string

Bug #1746847 reported by Dou Rui Yuan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.config
Invalid
Undecided
Dou Rui Yuan

Bug Description

CONF._get(name, group) will failed if group is string and namespace is not none:

2018-02-02 09:14:27.720 49134 ERROR glance Traceback (most recent call last):
2018-02-02 09:14:27.720 49134 ERROR glance File "/usr/bin/glance-api", line 10, in <module>
2018-02-02 09:14:27.720 49134 ERROR glance sys.exit(main())
2018-02-02 09:14:27.720 49134 ERROR glance File "/usr/lib/python2.7/site-packages/glance/cmd/api.py", line 88, in main
2018-02-02 09:14:27.720 49134 ERROR glance server.start(config.load_paste_app('glance-api'), default_port=9292)
2018-02-02 09:14:27.720 49134 ERROR glance File "/usr/lib/python2.7/site-packages/glance/common/wsgi.py", line 506, in start
2018-02-02 09:14:27.720 49134 ERROR glance self.configure()
2018-02-02 09:14:27.720 49134 ERROR glance File "/usr/lib/python2.7/site-packages/glance/common/wsgi.py", line 582, in configure
2018-02-02 09:14:27.720 49134 ERROR glance initialize_glance_store()
2018-02-02 09:14:27.720 49134 ERROR glance File "/usr/lib/python2.7/site-packages/glance/common/wsgi.py", line 428, in initialize_glance_store
2018-02-02 09:14:27.720 49134 ERROR glance glance_store.create_stores(CONF)
2018-02-02 09:14:27.720 49134 ERROR glance File "/usr/lib/python2.7/site-packages/glance_store/backend.py", line 329, in create_stores
2018-02-02 09:14:27.720 49134 ERROR glance real_store_entry = conf._get('store_driver', group=store_entry)
2018-02-02 09:14:27.720 49134 ERROR glance File "/usr/lib/python2.7/site-packages/oslo_config/cfg.py", line 2928, in _get
2018-02-02 09:14:27.720 49134 ERROR glance value = self._do_get(name, group, namespace)
2018-02-02 09:14:27.720 49134 ERROR glance File "/usr/lib/python2.7/site-packages/oslo_config/cfg.py", line 2963, in _do_get
2018-02-02 09:14:27.720 49134 ERROR glance group_name = group.name if group else None
2018-02-02 09:14:27.720 49134 ERROR glance AttributeError: 'str' object has no attribute 'name'
2018-02-02 09:14:27.720 49134 ERROR glance

Dou Rui Yuan (rydou)
Changed in oslo.config:
status: New → In Progress
assignee: nobody → Dou Rui Yuan (rydou)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo.config (master)

Fix proposed to branch: master
Review: https://review.openstack.org/540208

Revision history for this message
Doug Hellmann (doug-hellmann) wrote :

The _get() method is private (indicated by the _ prefix in the name), so it shouldn't be called directly from application code.

The correct way to access the config setting is CONF.group_name.store_driver where "group_name" is whatever the value of the story_entry variable is in the traceback above.

Changed in oslo.config:
status: In Progress → Invalid
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on oslo.config (master)

Change abandoned by Dou Rui Yuan (<email address hidden>) on branch: master
Review: https://review.openstack.org/540208

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.