本文整理汇总了Python中charmhelpers.contrib.openstack.utils.config_flags_parser方法的典型用法代码示例。如果您正苦于以下问题:Python utils.config_flags_parser方法的具体用法?Python utils.config_flags_parser怎么用?Python utils.config_flags_parser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类charmhelpers.contrib.openstack.utils
的用法示例。
在下文中一共展示了utils.config_flags_parser方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __call__
# 需要导入模块: from charmhelpers.contrib.openstack import utils [as 别名]
# 或者: from charmhelpers.contrib.openstack.utils import config_flags_parser [as 别名]
def __call__(self):
conf = config('config-flags')
if not conf:
return {}
conf = config_flags_parser(conf)
if not isinstance(conf, dict):
log("Provided config-flags is not a dictionary - ignoring",
level=WARNING)
return {}
permitted = self.permitted_sections
if permitted:
diff = set(conf.keys()).difference(set(permitted))
if diff:
log("Config-flags contains invalid keys '%s' - they will be "
"ignored" % (', '.join(diff)), level=WARNING)
ceph_conf = {}
for key in conf:
if permitted and key not in permitted:
log("Ignoring key '%s'" % key, level=WARNING)
continue
ceph_conf[key] = conf[key]
return ceph_conf
示例2: ldap_options
# 需要导入模块: from charmhelpers.contrib.openstack import utils [as 别名]
# 或者: from charmhelpers.contrib.openstack.utils import config_flags_parser [as 别名]
def ldap_options(self):
return os_utils.config_flags_parser(
hookenv.config('ldap-config-flags')
)
示例3: __call__
# 需要导入模块: from charmhelpers.contrib.openstack import utils [as 别名]
# 或者: from charmhelpers.contrib.openstack.utils import config_flags_parser [as 别名]
def __call__(self):
conf = config('config-flags')
if not conf:
return {}
conf = config_flags_parser(conf)
if type(conf) != dict:
log("Provided config-flags is not a dictionary - ignoring",
level=WARNING)
return {}
permitted = self.permitted_sections
if permitted:
diff = set(conf.keys()).difference(set(permitted))
if diff:
log("Config-flags contains invalid keys '%s' - they will be "
"ignored" % (', '.join(diff)), level=WARNING)
ceph_conf = {}
for key in conf:
if permitted and key not in permitted:
log("Ignoring key '%s'" % key, level=WARNING)
continue
ceph_conf[key] = conf[key]
return ceph_conf