nfv/nfv/nfv-plugins/nfv_plugins/nfvi_plugins/config.py
Bart Wensley e547b8c136 Add support for containerized keystone to VIM
Adding support to the VIM for containerized keystone. The
VIM will now support two keystone instances:
- platform: bare metal keystone used to authenticate with
  platform services (e.g. sysinv, patching)
- openstack: containerized keystone used to authenticate with
  openstack services (e.g. nova, neutron, cinder)

For now, the VIM will use the same baremetal keystone for both
the platform and openstack, because we still only deploy with
the baremetal keystone.

Story: 2002876
Task: 26872

Depends-On: If4bd46a4c14cc65978774001cb2887e5d3e3607b
Change-Id: Id1ec639aa347e0c4e4019576d3c36c8c72aefedf
2018-10-03 08:29:08 -05:00

36 lines
794 B
Python
Executable File

#
# Copyright (c) 2015-2018 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
from six.moves import configparser
# Configuration Global used by other modules to get access to the configuration
# specified in the ini file.
CONF = dict()
class Config(configparser.ConfigParser):
"""
Override ConfigParser class to add dictionary functionality.
"""
def as_dict(self):
d = dict(self._sections)
for key in d:
d[key] = dict(self._defaults, **d[key])
d[key].pop('__name__', None)
return d
def load(config_file):
"""
Load the configuration file into a global CONF variable.
"""
global CONF
if not CONF:
config = Config()
config.read(config_file)
CONF = config.as_dict()