2288d36ef20625c94ad466172c880480a1edd61a
[doctor.git] / tests / config.py
1 ##############################################################################\r
2 # Copyright (c) 2017 ZTE Corporation and others.\r
3 #\r
4 # All rights reserved. This program and the accompanying materials\r
5 # are made available under the terms of the Apache License, Version 2.0\r
6 # which accompanies this distribution, and is available at\r
7 # http://www.apache.org/licenses/LICENSE-2.0\r
8 ##############################################################################\r
9 from oslo_config import cfg\r
10 \r
11 import image\r
12 import os_clients\r
13 \r
14 \r
15 def list_opts():\r
16     return [\r
17         ('os_clients', os_clients.OPTS),\r
18         ('image', image.IMAGE_OPTS),\r
19     ]\r
20 \r
21 \r
22 def prepare_conf(conf=None):\r
23     if conf is None:\r
24         conf = cfg.ConfigOpts()\r
25 \r
26     for group, options in list_opts():\r
27         conf.register_opts(list(options),\r
28                            group=None if group == 'DEFAULT' else group)\r
29 \r
30     return conf\r