cloud-config merging not forward or backward compatible

Bug #1180867 reported by Scott Moser on 2013-05-16
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init (Ubuntu)

Bug Description

=== Begin SRU Information ===
 Users of who had used cloud-init's multi-part user-data and cloud-config in previous ubuntu releases will find it does not behave like previous ubuntu releases. Their existing user-data configurations will be broken.

 If we do not fix this in 13.04, then users will have to know that they provide one set of user-data to Ubuntu images for 13.04 and another set for all other releases. This forces a special case to the end user that is very much non-desireable.

 The merge routines upstream now include tests to ensure that they behave like previous releases do (both ubuntu releases and upstream cloud-init releases).

[Test Case]
Launch an instance with the following user-data:
$ cat > user-data <<<"EOF"
- |
   - ssh-import-id
   - locale
   - runcmd
- |
   - ssh-import-id
   - locale
- |
   - [sh, -c, 'echo "==== $(date -R) : runcmd ====" > /run/runcmd.txt' ]

The expected behavior (in 12.04, 12.10, and 13.10) is that the 'runcmd'
module should have been removed from the list of cloud-config-modules.
As a result, the shell command provided should not run.

In a current cloud instance, it will run.

To verify this, ssh into the instance and:
 $ cat /run/runcmd.txt
That will verify the 'runcmd' module ran.

To see a list of all config_modules that ran, do this:
 $ mods=$(python -c 'import yaml; print " ".join(yaml.load(open("/etc/cloud/cloud.cfg"))["cloud_config_modules"])')
 $ for mod in $mods; do f=/var/lib/cloud/instance/sem/config-$mod; [ -f $f -o -f ${f//-/_} ] && echo $mod; done

Its expected that the only config modules to have run are 'ssh-import-id' and 'locale', but on raring you'll see many more.

[Regression Potential]
 Users who have started using 13.10 and have been bit by this bug could have special cased this already, and an SRU will cause them to have to remove that special case. That is unfortunate, but generally removal of special case code is a good thing.

[Other Info / Background]
 cloud-init has always supported user-data being composed of multiple parts. Each of those parts can be of a different type. For cloud-config types, each subsequent part was merged "over" top of the existing cloud-config. The merge algoritm was very simplistic.
 In the 0.7.2 development cycle we added a new way for users to use more functional merge algorithms to get better behavior. This was developed to be backwards compatible with 0.7.1. Essentially, in order to get new behavior, the user had to add additional information to the cloud-config part. The code that shipped in Ubuntu's snapshot of 0.7.2 development cycle is not backwards compatible.

=== End SRU Information ===

cloud-init in the 0.7.2 time frame added the ability for user to specify how a cloud-config part should be merged into the existing cloud-config. Basically this means that instead of overwriting a list, the user can chose to append to it.

This was fixed in upstream revision 813 and is fixed in 0.7.2 release.
The 0.7.2 release is intended to be backwards compatible with 0.7.1.

Robie Basak (racb) on 2013-05-17
Changed in cloud-init (Ubuntu):
status: New → Triaged
Chris Halse Rogers (raof) wrote :

It's not clear to me that this bug is an appropriate SRU candidate.

If you believe it is, please expand on the justification. It might help for you to follow the SRU bug template¹ - you're also missing a test-case we can use to verify that this bug is fixed, and what should be checked to be confident that the change doesn't introduce any regressions.


Scott Moser (smoser) on 2013-06-05
Changed in cloud-init (Ubuntu):
importance: Undecided → Medium
status: Triaged → Fix Released
Changed in cloud-init (Ubuntu Raring):
status: New → In Progress
importance: Undecided → High
Scott Moser (smoser) on 2013-06-05
description: updated
Changed in cloud-init (Ubuntu):
status: Fix Released → In Progress
description: updated
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cloud-init - 0.7.2-0ubuntu1

cloud-init (0.7.2-0ubuntu1) saucy; urgency=low

  * New upstream release.
    * fix merging routines to be backwards compatible (LP: #1180867)
    * fix for python 2.6
 -- Scott Moser <email address hidden> Wed, 05 Jun 2013 11:12:46 -0400

Changed in cloud-init (Ubuntu):
status: In Progress → Fix Released

Hello Scott, or anyone else affected,

Accepted cloud-init into raring-proposed. The package will build now and be available at in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at . Thank you in advance!

Changed in cloud-init (Ubuntu Raring):
status: In Progress → Fix Committed
tags: added: verification-needed
Scott Moser (smoser) wrote :

verified in raring.
- launch instance with given user data above
- rm -Rf /var/lib/cloud /var/log/cloud-init.log
- echo "deb raring-proposed main" | sudo tee -a /etc/apt/sources.list
- sudo apt-get install cloud-init
- apt-cache policy cloud-init
  Installed: 0.7.2-0ubuntu0.13.04.1
  Candidate: 0.7.2-0ubuntu0.13.04.1
  Version table:
 *** 0.7.2-0ubuntu0.13.04.1 0
        500 raring-proposed/main amd64 Packages
        100 /var/lib/dpkg/status
     0.7.2~bzr809-0ubuntu1 0
        500 raring/main amd64 Packages

sudo reboot

verify on reboot that there is no /run/runcmd.txt
$ ls -l /run/runcmd.txt
ls: cannot access /run/runcmd.txt: No such file or directory

tags: added: verification-done
removed: verification-needed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cloud-init - 0.7.2-0ubuntu0.13.04.1

cloud-init (0.7.2-0ubuntu0.13.04.1) raring-proposed; urgency=low

  * New upstream release.
    * fix merging routines to be backwards compatible (LP: #1180867)
    * fix maas datasource if user-data is not present (LP: #1172742)
    * fix for python 2.6
    * Fix chef omnibus installation support. (LP: #1182265)
 -- Scott Moser <email address hidden> Thu, 20 Jun 2013 16:49:52 -0400

Changed in cloud-init (Ubuntu Raring):
status: Fix Committed → Fix Released

The verification of this Stable Release Update has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers