Merge "Change PTL informatin in INFO"
[bottlenecks.git] / testsuites / vstf / vstf_scripts / vstf / common / cfgparser.py
1 ##############################################################################
2 # Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
3 #
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9
10 import os
11 from oslo.config import cfg
12
13
14 class CfgParser(object):
15
16     def __init__(self, config_file):
17         super(CfgParser, self).__init__()
18         if os.path.isfile(config_file) is False:
19             raise Exception('The config file not found <%s>' % config_file)
20         self.config_file = config_file
21         self.CONF = cfg.ConfigOpts()
22
23     def register_my_opts(self, opts, name=None):
24         if name:
25             self.CONF.register_opts(opts, name)
26         else:
27             self.CONF.register_opts(opts)
28
29     def parse(self):
30         #  self.register_my_opts(opts, name=name)
31         self.CONF(args=[], default_config_files=[self.config_file])
32         return self.CONF