base64 user-data broken in OVF datasource
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Fix Released
|
Medium
|
Unassigned | ||
cloud-init (Ubuntu) |
Fix Released
|
Medium
|
Unassigned | ||
Xenial |
Fix Released
|
Medium
|
Unassigned |
Bug Description
==== Begin SRU Template ====
[Impact]
Users of the OVF datasource can not provide user-data that is base64 encoded.
[Test Case]
$ rel=xenial
$ burl="http://
$ disk="$
$ wget "$burl/$disk" -O "$disk"
# prepare the ovftransport.iso
$ git clone http://
$ ( cd cloud-init/
# create a temp disk for patching and patch in -proposed
$ qemu-img create -f qcow2 -b "$disk" disk.img
$ sudo mount-image-
sh -c 'l=/etc/
echo deb http://
apt-get -q update && apt-get install -qy cloud-init'
$ qemu-system-x86_64 -enable-kvm \
-device virtio-
-hda disk.img -cdrom ovftransport.iso -m 512 -curses -snapshot
# you will see an 'ovfdemo' login prompt, log in as root:passw0rd
# verify it worked by cat /var/lib/
[Regression Potential]
very low chance for regression, a guest with user-data would be broken previously.
==== End SRU Template ====
I am using cloudint 0.7.7~bzr1256-
When I pass yaml-formatted user-data over the OVF datasource over the ISO transport the yaml string fails to be parsed.
I tracked this to minidom's inability to handle newlines in an attribute. The xml bellow works for coreos but breaks under cloud-init:
<PropertySection>
<Property oe:key="user-data" oe:value=
---
users:
- name: "test"
passwd: "$1$NVdKo9MI$
groups:
- "sudo"
"/>
</PropertySection>
If I use base64-encoded user-data I get this error:
Sep 01 12:07:43 sof2-lab3-dhcp371 cloud-init[3248]: 2016-09-01 12:07:43,854 - __init_
Sep 01 12:07:43 sof2-lab3-dhcp371 cloud-init[3248]: [CLOUDINIT] __init_
Is there a way to pass user-data as a single-line string that doesn't confuse minidom?
Related branches
- cloud-init Commiters: Pending requested
-
Diff: 123 lines (+87/-4)2 files modifiedcloudinit/sources/DataSourceOVF.py (+4/-4)
tests/unittests/test_datasource/test_ovf.py (+83/-0)
Changed in cloud-init (Ubuntu): | |
status: | New → Fix Released |
importance: | Undecided → Medium |
Changed in cloud-init (Ubuntu Xenial): | |
status: | New → In Progress |
importance: | Undecided → Medium |
summary: |
- OVF datasource broken + base64 user-data broken in OVF datasource |
description: | updated |
tags: |
added: verification-done removed: verification-needed |
fwiw, i'm pretty sure it is invalid ovf to have newlines in the value of property.
minidom might be doing the right thing.
the fix for this in cloud-init is to allow you to pass in base64 encoded string in that user-data.
that path was broken in python3.
Julian put a branch to fix that at https:/ /code.launchpad .net/~jvassev/ cloud-init/ +git/cloud- init/+ref/ fix-b64decode- ovf .
I've put a branch up at https:/ /code.launchpad .net/~smoser/ cloud-init/ +git/cloud- init/+merge/ 305496 with a unit test, and i'm going to pull that in now.