本文整理匯總了Python中sm.config.CONFIG.getboolean方法的典型用法代碼示例。如果您正苦於以下問題:Python CONFIG.getboolean方法的具體用法?Python CONFIG.getboolean怎麽用?Python CONFIG.getboolean使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sm.config.CONFIG
的用法示例。
在下文中一共展示了CONFIG.getboolean方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from sm.config import CONFIG [as 別名]
# 或者: from sm.config.CONFIG import getboolean [as 別名]
def __init__(self, app, srv_type=None):
# openstack objects tracking the keystone service and endpoint
self.srv_ep = None
self.ep = None
self.DEBUG = True
self.app = app
self.service_backend = ServiceBackend(app)
LOG.info("Using configuration file: " + CONFIG_PATH)
self.token, self.tenant_name = self.get_service_credentials()
self.design_uri = CONFIG.get("service_manager", "design_uri", "")
if self.design_uri == "":
LOG.fatal("No design_uri parameter supplied in sm.cfg")
raise Exception("No design_uri parameter supplied in sm.cfg")
self.stg = None
stg_path = CONFIG.get("service_manager", "manifest", "")
if stg_path == "":
raise RuntimeError("No STG specified in the configuration file.")
with open(stg_path) as stg_content:
self.stg = json.load(stg_content)
stg_content.close()
if not srv_type:
srv_type = self.create_service_type()
self.srv_type = srv_type
self.reg_srv = CONFIG.getboolean("service_manager_admin", "register_service")
if self.reg_srv:
self.region = CONFIG.get("service_manager_admin", "region", "")
if self.region == "":
LOG.info("No region parameter specified in sm.cfg, defaulting to an OpenStack default: RegionOne")
self.region = "RegionOne"
self.service_endpoint = CONFIG.get("service_manager_admin", "service_endpoint")
if self.service_endpoint != "":
LOG.warn(
"DEPRECATED: service_endpoint parameter supplied in sm.cfg! Endpoint is now specified in "
"service manifest as service_endpoint"
)
LOG.info(
"Using " + self.stg["service_endpoint"] + " as the service_endpoint value " "from service manifest"
)
up = urlparse(self.stg["service_endpoint"])
self.service_endpoint = up.scheme + "://" + up.hostname + ":" + str(up.port)
示例2: __init__
# 需要導入模塊: from sm.config import CONFIG [as 別名]
# 或者: from sm.config.CONFIG import getboolean [as 別名]
def __init__(self, app, srv_type=None):
# openstack objects tracking the keystone service and endpoint
self.srv_ep = None
self.ep = None
self.DEBUG = True
self.app = app
self.service_backend = ServiceBackend(app)
LOG.info('Using configuration file: ' + CONFIG_PATH)
self.token, self.tenant_name = self.get_service_credentials()
self.design_uri = CONFIG.get('service_manager', 'design_uri', '')
if self.design_uri == '':
LOG.fatal('No design_uri parameter supplied in sm.cfg')
raise Exception('No design_uri parameter supplied in sm.cfg')
self.stg = None
stg_path = CONFIG.get('service_manager', 'manifest', '')
if stg_path == '':
raise RuntimeError('No STG specified in the configuration file.')
with open(stg_path) as stg_content:
self.stg = json.load(stg_content)
stg_content.close()
if not srv_type:
srv_type = self.create_service_type()
self.srv_type = srv_type
self.reg_srv = CONFIG.getboolean('service_manager_admin', 'register_service')
if self.reg_srv:
self.region = CONFIG.get('service_manager_admin', 'region', '')
if self.region == '':
LOG.info('No region parameter specified in sm.cfg, defaulting to an OpenStack default: RegionOne')
self.region = 'RegionOne'
self.service_endpoint = CONFIG.get('service_manager_admin', 'service_endpoint')
if self.service_endpoint != '':
LOG.warn('DEPRECATED: service_endpoint parameter supplied in sm.cfg! Endpoint is now specified in '
'service manifest as service_endpoint')
LOG.info('Using ' + self.stg['service_endpoint'] + ' as the service_endpoint value '
'from service manifest')
up = urlparse(self.stg['service_endpoint'])
self.service_endpoint = up.scheme + '://' + up.hostname + ':' + str(up.port) + '/' + str('mobaas')
LOG.info(self.service_endpoint)