Change-Id: Ib8e696acfe21787904fce6838341f3a256aa0267
Signed-off-by: dongwenjuan <dong.wenjuan@zte.com.cn>
--- /dev/null
+##############################################################################
+# Copyright (c) 2017 ZTE Corporation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+[DEFAULT]
+image_name = cirros
+image_format = qcow2
+image_filename = cirros.img
+image_download_url = https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img
+
+glance_version = 2
+nova_version = 2.34
+
+doctor_user = doctor
+doctor_passwd = doctor
+doctor_project = doctor
+doctor_role = _member_
+quota_instances = 1
+quota_cores = 1
+
+
+
# http://www.apache.org/licenses/LICENSE-2.0\r
##############################################################################\r
import itertools\r
# http://www.apache.org/licenses/LICENSE-2.0\r
##############################################################################\r
import itertools\r
from oslo_config import cfg\r
\r
import image\r
from oslo_config import cfg\r
\r
import image\r
-def prepare_conf(conf=None):\r
+def prepare_conf(args=None, conf=None, config_files=None):\r
if conf is None:\r
conf = cfg.ConfigOpts()\r
\r
if conf is None:\r
conf = cfg.ConfigOpts()\r
\r
conf.register_opts(list(options),\r
group=None if group == 'DEFAULT' else group)\r
\r
conf.register_opts(list(options),\r
group=None if group == 'DEFAULT' else group)\r
\r
+ conf(args, project='doctor', validate_default_values=True,\r
+ default_config_files=config_files)\r
+\r
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+import os
+from os.path import isfile, join
def main():
"""doctor main"""
def main():
"""doctor main"""
- conf = config.prepare_conf()
+ doctor_root_dir = os.path.dirname(os.getcwd())
+ config_file_dir = '{0}/{1}'.format(doctor_root_dir, 'etc/')
+ config_files = [join(config_file_dir, f) for f in os.listdir(config_file_dir)
+ if isfile(join(config_file_dir, f))]
+
+ conf = config.prepare_conf(args=sys.argv[1:],
+ config_files=config_files)
doctor = DoctorTest(conf)
doctor.run()
doctor = DoctorTest(conf)
doctor.run()