restoring from datasource without dsmode causes stacktrace

Bug #1596690 reported by Scott Moser on 2016-06-27
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init
High
Scott Moser
cloud-init (Ubuntu)
High
Scott Moser
Xenial
Medium
Scott Moser

Bug Description

On reboot, if cloud-init found a cached /var/lib/cloud/instance/obj.pkl it would restore from it.
If that class did not have a 'dsmode', then main would stack trace like:
| "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 530, in status_wrapper
| ret = functor(name, args)
| File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 247, in main_init
| if mode == sources.DSMODE_NETWORK and init.datasource.dsmode != mode:
| AttributeError: 'DataSourceAzureNet' object has no attribute 'dsmode'

This would affect upgrade and reboot on any datasource that did not have a dsmode previously.

That list is
  cloudinit/sources/DataSourceAzure.py
  cloudinit/sources/DataSourceBigstep.py
  cloudinit/sources/DataSourceCloudStack.py
  cloudinit/sources/DataSourceDigitalOcean.py
  cloudinit/sources/DataSourceEc2.py
  cloudinit/sources/DataSourceGCE.py
  cloudinit/sources/DataSourceMAAS.py
  cloudinit/sources/DataSourceNone.py
  cloudinit/sources/DataSourceOVF.py
  cloudinit/sources/DataSourceSmartOS.py

The non-broken datasources then were the ones that previously had a dsmode:
  cloudinit/sources/DataSourceAltCloud.py
  cloudinit/sources/DataSourceCloudSigma.py
  cloudinit/sources/DataSourceConfigDrive.py
  cloudinit/sources/DataSourceNoCloud.py
  cloudinit/sources/DataSourceOpenNebula.py
  cloudinit/sources/DataSourceOpenStack.py

Related branches

Hello Scott, or anyone else affected,

Accepted cloud-init into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/cloud-init/0.7.7~bzr1246-0ubuntu1~16.04.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed 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 https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

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

This bug was fixed in the package cloud-init - 0.7.7~bzr1246-0ubuntu1

---------------
cloud-init (0.7.7~bzr1246-0ubuntu1) yakkety; urgency=medium

  * New upstream snapshot.
    - fix restoring from a datasource that did not have dsmode (LP: #1596690)

 -- Scott Moser <email address hidden> Mon, 27 Jun 2016 16:28:39 -0400

Changed in cloud-init (Ubuntu):
status: New → Fix Released
Scott Moser (smoser) wrote :

fixed in trunk at revno 1246

Changed in cloud-init:
assignee: nobody → Scott Moser (smoser)
importance: Undecided → High
status: New → Fix Committed
Changed in cloud-init (Ubuntu):
importance: Undecided → High
Changed in cloud-init (Ubuntu Xenial):
status: New → Fix Committed
importance: Undecided → Medium
assignee: nobody → Scott Moser (smoser)
Changed in cloud-init (Ubuntu):
assignee: nobody → Scott Moser (smoser)
tags: added: verification-done
removed: verification-needed
Scott Moser (smoser) wrote :

I've marked this verification-done for xenial.
The tests in bug 1595302 cover this also.
Specifically, the upgrade test on azure exposed this bug in the first place, and the tests there show it fixed.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cloud-init - 0.7.7~bzr1246-0ubuntu1~16.04.1

---------------
cloud-init (0.7.7~bzr1246-0ubuntu1~16.04.1) xenial-proposed; urgency=medium

  * New upstream snapshot.
    - fix restoring from a datasource that did not have dsmode (LP: #1596690)

cloud-init (0.7.7~bzr1245-0ubuntu1~16.04.1) xenial-proposed; urgency=medium

  * debian/new-upstream-snapshot: minor change supporting revision
    passed in as an argument.
  * debian/control: Build-Depends on python3-unittest2
  * SRU Upstream to 16.04 (LP: #1595302).
    - user_data: fix error when user-data is not utf-8 decodable
    - write_files: if no permissions are provided, use the default without
      logging a warning.
    - do not write /etc/systemd/network/50-cloud-init-*.link files
    - fix several potential errors identified by pylint.
    - move 'main' into cloudinit/cmd/ for easier testing
    - Remove trailing dot from GCE metadata URL [Phil Roche]
    - Refactor cloudinit networking module to improve testing
    - Change missing Cheetah log warning to debug [Andrew Jorgensen]
    - network configuration improvements
      - centrally handle 'dsmode' (DataSource mode) to be 'local' or 'net.
      - support networking information being read on dreamcompute
      - support reading and applying networking information on SmartOS
      - improve reading networking from openstack network_data.json
      - support for renaming devices in a container.
      - remove blocking of udev rules
    - Apt sources configuration improvements
    - cloud-config specified on kernel command line will now override
      system settings.
    - fix timestamp in reporting events.
    - Paths: fix instance path if datasource's id has a '/'.
    - Config Drive: fix check_instance_id signature.
    - cloudstack: Only use DHCPv4 lease files as a datasource

 -- Scott Moser <email address hidden> Mon, 27 Jun 2016 16:31:37 -0400

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

The verification of the Stable Release Update for cloud-init 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 regressions.

Scott Moser (smoser) wrote :

This is fixed in cloud-init 0.7.7

Changed in cloud-init:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers