Skip to content
This repository has been archived by the owner on Apr 7, 2022. It is now read-only.

Configuration YAMLs

Sean Myers edited this page Jan 6, 2014 · 6 revisions

utils.conf: YAML file loader

All YAML files stored in the conf/ directory of the project are automatically parsed and loaded by the utils.conf module on request by the utils.conf module. The parsed files are exposed as importable attributes of the yaml file name in the module.

For example, consider the conf/cfme_data.yaml file:

# Import utils.conf, use cfme_data with a fully qualified name
import utils.conf
provider = utils.conf.cfme_data['management_systems']['provider_name']
# Access cfme_data as an attribute of conf
from utils import conf
provider = conf.cfme_data['management_systems']['provider_name']
# Or just import cfme_data directly
from utils.conf import cfme_data
provider = .cfme_data['management_systems']['provider_name']

Local Configuration Overrides

In addition to loading YAML files, the utils.conf loader supports local override files. This feature is useful for maintaining a shared set of config files for a team, while still allowing for local configuration.

Take the following example YAML files:

# conf/example.yaml
a: 'foo'
b: 'spam'
# conf/example.local.yaml
a: ' bar'

When loaded by the conf loader, the 'a' key will be automatically overridden by the value in the local YAML file:

from utils.conf import example
print example
{ 'a': 'bar', 'b': 'spam' }
Clone this wiki locally