summaryrefslogtreecommitdiff
path: root/cloudinit/sources/DataSourceAzure.py
diff options
context:
space:
mode:
authorDaniel Watkins <daniel.watkins@canonical.com>2015-02-18 13:30:51 +0000
committerDaniel Watkins <daniel.watkins@canonical.com>2015-02-18 13:30:51 +0000
commit589ced475c9e200d4645f0b06f7846dae412b194 (patch)
tree2670497ceaaecf2e943d691b0ccf2f916beebb07 /cloudinit/sources/DataSourceAzure.py
parentd47a6e5bf47287c50932812a5b64f763b8abcbe9 (diff)
downloadvyos-cloud-init-589ced475c9e200d4645f0b06f7846dae412b194.tar.gz
vyos-cloud-init-589ced475c9e200d4645f0b06f7846dae412b194.zip
Read ovf-env.xml as bytes.
This should fix the Azure data source on Python 3, and is appropriate as XML shouldn't really be read as a string.
Diffstat (limited to 'cloudinit/sources/DataSourceAzure.py')
-rw-r--r--cloudinit/sources/DataSourceAzure.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py
index 444070bb..6e030217 100644
--- a/cloudinit/sources/DataSourceAzure.py
+++ b/cloudinit/sources/DataSourceAzure.py
@@ -137,7 +137,7 @@ class DataSourceAzureNet(sources.DataSource):
if found != ddir:
cached_ovfenv = util.load_file(
- os.path.join(ddir, 'ovf-env.xml'), quiet=True)
+ os.path.join(ddir, 'ovf-env.xml'), quiet=True, decode=False)
if cached_ovfenv != files['ovf-env.xml']:
# source was not walinux-agent's datadir, so we have to clean
# up so 'wait_for_files' doesn't return early due to stale data
@@ -593,7 +593,7 @@ def load_azure_ds_dir(source_dir):
if not os.path.isfile(ovf_file):
raise NonAzureDataSource("No ovf-env file found")
- with open(ovf_file, "r") as fp:
+ with open(ovf_file, "rb") as fp:
contents = fp.read()
md, ud, cfg = read_azure_ovf(contents)