1 ##############################################################################
2 # Copyright (c) 2018 ZTE Corporation and others.
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 ##############################################################################
13 def set_drivers_config():
14 co_conf = "/etc/congress/congress.conf"
15 co_conf_bak = "/etc/congress/congress.conf.bak"
16 doctor_driver = "congress.datasources.doctor_driver.DoctorDriver"
17 config_modified = False
19 config = configparser.ConfigParser()
21 drivers = config['DEFAULT']['drivers']
23 if doctor_driver not in drivers:
24 config_modified = True
25 drivers += ',' + doctor_driver
27 config['DEFAULT']['drivers'] = drivers
30 shutil.copyfile(co_conf, co_conf_bak)
31 with open(co_conf, 'w') as configfile:
32 config.write(configfile)