diff options
Diffstat (limited to 'cloudinit/sources')
-rw-r--r-- | cloudinit/sources/DataSourceOpenNebula.py | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/cloudinit/sources/DataSourceOpenNebula.py b/cloudinit/sources/DataSourceOpenNebula.py index 6da569ec..a0275cda 100644 --- a/cloudinit/sources/DataSourceOpenNebula.py +++ b/cloudinit/sources/DataSourceOpenNebula.py @@ -25,7 +25,6 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. import base64 -import codecs import os import pwd import re @@ -35,7 +34,6 @@ from cloudinit import log as logging from cloudinit import sources from cloudinit import util -import six LOG = logging.getLogger(__name__) @@ -46,12 +44,6 @@ CONTEXT_DISK_FILES = ["context.sh"] VALID_DSMODES = ("local", "net", "disabled") -def utf8_open(path): - if six.PY3: - return open(path, 'r', encoding='utf-8') - return codecs.open(path, 'r', encoding='utf-8') - - class DataSourceOpenNebula(sources.DataSource): def __init__(self, sys_cfg, distro, paths): sources.DataSource.__init__(self, sys_cfg, distro, paths) @@ -389,9 +381,7 @@ def read_context_disk_dir(source_dir, asuser=None): "does not exist", asuser) try: path = os.path.join(source_dir, 'context.sh') - with utf8_open(path) as f: - content = f.read().strip() - + content = util.load_file(path) context = parse_shell_config(content, asuser=asuser) except util.ProcessExecutionError as e: raise BrokenContextDiskDir("Error processing context.sh: %s" % (e)) |