當前位置: 首頁>>代碼示例>>Python>>正文


Python utils.config_flags_parser方法代碼示例

本文整理匯總了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 
開發者ID:openstack,項目名稱:charm-swift-proxy,代碼行數:29,代碼來源:ceph.py

示例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')
        ) 
開發者ID:openstack,項目名稱:charm-keystone-ldap,代碼行數:6,代碼來源:keystone_ldap.py

示例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 
開發者ID:konono,項目名稱:equlipse,代碼行數:29,代碼來源:ceph.py


注:本文中的charmhelpers.contrib.openstack.utils.config_flags_parser方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。