summaryrefslogtreecommitdiffstats
path: root/roles/openshift_facts/library
diff options
context:
space:
mode:
authorAndrew Butcher <abutcher@redhat.com>2016-05-12 10:49:46 -0400
committerAndrew Butcher <abutcher@redhat.com>2016-05-12 14:37:49 -0400
commit3761fe0f2837d5b74b56cca2ed6a7ad465e77df2 (patch)
treec14926a5deee4ac1dc6aafc92f153bb9a858b863 /roles/openshift_facts/library
parentae34281f89e1b62dc95ef33a30a20bbb7c70b077 (diff)
downloadopenshift-3761fe0f2837d5b74b56cca2ed6a7ad465e77df2.tar.gz
openshift-3761fe0f2837d5b74b56cca2ed6a7ad465e77df2.tar.bz2
openshift-3761fe0f2837d5b74b56cca2ed6a7ad465e77df2.tar.xz
openshift-3761fe0f2837d5b74b56cca2ed6a7ad465e77df2.zip
Update StringIO import for py2/3 compat.
Diffstat (limited to 'roles/openshift_facts/library')
-rwxr-xr-xroles/openshift_facts/library/openshift_facts.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py
index cb8301da4..b1ad537bc 100755
--- a/roles/openshift_facts/library/openshift_facts.py
+++ b/roles/openshift_facts/library/openshift_facts.py
@@ -19,8 +19,8 @@ EXAMPLES = '''
import ConfigParser
import copy
+import io
import os
-import StringIO
import yaml
from distutils.util import strtobool
from distutils.version import LooseVersion
@@ -689,7 +689,7 @@ def set_etcd_facts_if_unset(facts):
If anything goes wrong parsing these, the fact will not be set.
"""
- if 'master' in facts and facts['master']['embedded_etcd']:
+ if 'master' in facts and safe_get_bool(facts['master']['embedded_etcd']):
etcd_facts = facts['etcd'] if 'etcd' in facts else dict()
if 'etcd_data_dir' not in etcd_facts:
@@ -716,8 +716,8 @@ def set_etcd_facts_if_unset(facts):
# Read ETCD_DATA_DIR from /etc/etcd/etcd.conf:
try:
# Add a fake section for parsing:
- ini_str = '[root]\n' + open('/etc/etcd/etcd.conf', 'r').read()
- ini_fp = StringIO.StringIO(ini_str)
+ ini_str = unicode('[root]\n' + open('/etc/etcd/etcd.conf', 'r').read(), 'utf-8')
+ ini_fp = io.StringIO(ini_str)
config = ConfigParser.RawConfigParser()
config.readfp(ini_fp)
etcd_data_dir = config.get('root', 'ETCD_DATA_DIR')