diff options
author | dongwenjuan <dong.wenjuan@zte.com.cn> | 2018-10-27 10:40:07 +0800 |
---|---|---|
committer | dongwenjuan <dong.wenjuan@zte.com.cn> | 2018-10-27 11:03:58 +0800 |
commit | 53416ca31633c9b9d1924f4ef35c70c045fa0101 (patch) | |
tree | 95d9c48ac7764e7c5479966b3e72b9891e1c40b2 | |
parent | baac6579556f8216b36db0d0f87f9c2d4f8b4ef5 (diff) |
fix the configparser for Python 2 and 3 Compatibility
Change-Id: I6ea9c031a8093d7ce94b49575cb6bfe348eb6c9a
Signed-off-by: dongwenjuan <dong.wenjuan@zte.com.cn>
-rw-r--r-- | doctor_tests/installer/common/set_congress.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/doctor_tests/installer/common/set_congress.py b/doctor_tests/installer/common/set_congress.py index d2754838..7961df32 100644 --- a/doctor_tests/installer/common/set_congress.py +++ b/doctor_tests/installer/common/set_congress.py @@ -6,7 +6,7 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -import configparser +from six.moves import configparser import os import shutil @@ -22,13 +22,13 @@ def set_drivers_config(): config = configparser.ConfigParser() config.read(co_conf) - drivers = config['DEFAULT']['drivers'] + drivers = config.get('DEFAULT', 'drivers') if doctor_driver not in drivers: config_modified = True drivers += ',' + doctor_driver - config['DEFAULT']['drivers'] = drivers + config.set('DEFAULT', 'drivers', drivers) if config_modified: shutil.copyfile(co_conf, co_conf_bak) |