Bugzilla (bugzilla.redhat.com) will be under maintenance for infrastructure upgrades and will not be available on July 31st between 12:30 AM - 05:30 AM UTC. We appreciate your understanding and patience. You can follow status.redhat.com for details.
Bug 1127529 - [RFE][oslo]: JsonOpt Support for oslo.config
Summary: [RFE][oslo]: JsonOpt Support for oslo.config
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: RFEs
Version: unspecified
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
: ---
Assignee: RHOS Maint
QA Contact:
URL: https://blueprints.launchpad.net/oslo...
Whiteboard: upstream_milestone_none upstream_defi...
Depends On:
TreeView+ depends on / blocked
Reported: 2014-08-07 04:05 UTC by RHOS Integration
Modified: 2015-03-19 17:29 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Last Closed:
Target Upstream Version:

Attachments (Terms of Use)

Description RHOS Integration 2014-08-07 04:05:07 UTC
Cloned from launchpad blueprint https://blueprints.launchpad.net/oslo/+spec/jsonopt-oslo-config.


In oslo.config.cfg, it will be useful to have an Option for specifying Json, in addition to the existing types such as StrOpt, DictOpt, etc. For example, this will allows specifying a valid Json string as value to a config parameter as shown below:


Although this can be done in an indirect way by treating this as a StrOpt and then loading it into json after reading it from config file, it will be useful to have a native JsonOpt that performs this functionality.

The implementation of this is straight-forward with something like the following. Note that the below code needs to be enhanced with error checking, etc.

class Json(object):
 def __init__(self):
        super(Json, self).__init__()

    def __call__(self, value):
        import json
        return json.loads(str(value))
    def __repr__(self):
        return 'Json'

class JsonOpt(Opt):
    def __init__(self, name, **kwargs):
        super(JsonOpt, self).__init__(name,

Specification URL (additional information):


Note You need to log in before you can comment on or make changes to this bug.