diff options
author | Scott Dodson <sdodson@redhat.com> | 2017-01-10 16:27:29 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-10 16:27:29 -0500 |
commit | 393eccd3a5347a13eda5d627f3cc35aeeb42f1cc (patch) | |
tree | 668806139fc108ce6763cc95a640aedffa8a4ecf /roles/openshift_facts/library | |
parent | 706c582b2482d5cc3a4fb28b348ce5b856fc9c26 (diff) | |
parent | 33da32dbcdc5e93e26bccf59d0781a60386b6b04 (diff) | |
download | openshift-393eccd3a5347a13eda5d627f3cc35aeeb42f1cc.tar.gz openshift-393eccd3a5347a13eda5d627f3cc35aeeb42f1cc.tar.bz2 openshift-393eccd3a5347a13eda5d627f3cc35aeeb42f1cc.tar.xz openshift-393eccd3a5347a13eda5d627f3cc35aeeb42f1cc.zip |
Merge pull request #3007 from detiber/toxification
More Toxification
Diffstat (limited to 'roles/openshift_facts/library')
-rwxr-xr-x | roles/openshift_facts/library/openshift_facts.py | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index 0222b664b..6baf9d016 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -7,13 +7,6 @@ """Ansible module for retrieving and setting openshift related facts""" -try: - # python2 - import ConfigParser -except ImportError: - # python3 - import configparser as ConfigParser - # pylint: disable=no-name-in-module, import-error, wrong-import-order import copy import errno @@ -26,8 +19,8 @@ import struct import socket from distutils.util import strtobool from distutils.version import LooseVersion -from six import string_types -from six import text_type +from six import string_types, text_type +from six.moves import configparser # ignore pylint errors related to the module_utils import # pylint: disable=redefined-builtin, unused-wildcard-import, wildcard-import @@ -776,7 +769,7 @@ def set_etcd_facts_if_unset(facts): # Add a fake section for parsing: ini_str = text_type('[root]\n' + open('/etc/etcd/etcd.conf', 'r').read(), 'utf-8') ini_fp = io.StringIO(ini_str) - config = ConfigParser.RawConfigParser() + config = configparser.RawConfigParser() config.readfp(ini_fp) etcd_data_dir = config.get('root', 'ETCD_DATA_DIR') if etcd_data_dir.startswith('"') and etcd_data_dir.endswith('"'): @@ -1299,7 +1292,7 @@ def get_hosted_registry_insecure(): try: ini_str = text_type('[root]\n' + open('/etc/sysconfig/docker', 'r').read(), 'utf-8') ini_fp = io.StringIO(ini_str) - config = ConfigParser.RawConfigParser() + config = configparser.RawConfigParser() config.readfp(ini_fp) options = config.get('root', 'OPTIONS') if 'insecure-registry' in options: @@ -1568,15 +1561,15 @@ def get_local_facts_from_file(filename): local_facts = dict() try: # Handle conversion of INI style facts file to json style - ini_facts = ConfigParser.SafeConfigParser() + ini_facts = configparser.SafeConfigParser() ini_facts.read(filename) for section in ini_facts.sections(): local_facts[section] = dict() for key, value in ini_facts.items(section): local_facts[section][key] = value - except (ConfigParser.MissingSectionHeaderError, - ConfigParser.ParsingError): + except (configparser.MissingSectionHeaderError, + configparser.ParsingError): try: with open(filename, 'r') as facts_file: local_facts = json.load(facts_file) |