← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1922739] Re: AttributeError: 'DataSourceNoCloud' object has no attribute 'vendordata2_raw'

 

This bug was fixed in the package cloud-init -
21.1-19-gbad84ad4-0ubuntu1~20.04.2

---------------
cloud-init (21.1-19-gbad84ad4-0ubuntu1~20.04.2) focal; urgency=medium

  * cherry-pick 83f6bbfb: Fix unpickle for source paths missing run_dir
    (#863) (LP: #1899299)
  * cherry-pick d132356c: fix error on upgrade caused by new vendordata2
    attributes (LP: #1922739)

 -- James Falcon <james.falcon@xxxxxxxxxxxxx>  Mon, 19 Apr 2021 14:00:12
-0500

** Changed in: cloud-init (Ubuntu Bionic)
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1922739

Title:
  AttributeError: 'DataSourceNoCloud' object has no attribute
  'vendordata2_raw'

Status in cloud-init:
  Fix Committed
Status in cloud-init package in Ubuntu:
  Fix Released
Status in cloud-init source package in Xenial:
  Fix Released
Status in cloud-init source package in Bionic:
  Fix Released
Status in cloud-init source package in Focal:
  Fix Released
Status in cloud-init source package in Groovy:
  Fix Released
Status in cloud-init source package in Hirsute:
  Fix Released

Bug description:
  === Begin SRU Template ===
  [Impact]
  In PR #777, we added 'vendordata2' and 'vendordata2_raw' attributes to the DataSource class, but didn't use the upgrade framework to deal with an unpickle after upgrade. Because of this, anybody upgrading their cloud-init from an older version to 21.1 who hasn't also run `cloud-init clean` will have cloud-init fail with a traceback.

  The change here should fix that failure.

  [Test Plan]
  Launch an instance or install a cloud-init package using version earlier than 21.1-19-gbad84ad4-0ubuntu1 (if downgrading also run `cloud-init clean`).

  Upgrade to 21.1-19-gbad84ad4-0ubuntu1 or later, then reboot (without
  running `cloud-init clean`).

  On un-patched versions, `cloud-init status` will show error, and there
  will be a traceback in /var/log/cloud-init.log. Patched versions
  should show no error or traceback.

  [Where problems could occur]
  Any problem here would mean we're continuing to unpickle data incorrectly, thus we'd see similar behavior to the bug we're fixing.

  [Other Info]
  Pull request: https://github.com/canonical/cloud-init/pull/869
  Commit: https://github.com/canonical/cloud-init/commit/d132356cc361abef2d90d4073438f3ab759d5964

  A test has also been added upstream and to our CI to prevent these
  types of errors from happening in the future:
  https://github.com/canonical/cloud-
  init/blob/master/tests/integration_tests/test_upgrade.py#L107

  == End SRU Template ==

  == Original Description ==

  On a test LXD VM instance, I see:

  2021-04-06 14:05:11,296 - util.py[WARNING]: failed stage init
  2021-04-06 14:05:11,302 - util.py[DEBUG]: failed stage init
  Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 652, in status_wrapper
      ret = functor(name, args)
    File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 376, in main_init
      init.update()
    File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 371, in update
      self._store_raw_vendordata(self.datasource.get_vendordata2_raw(),
    File "/usr/lib/python3/dist-packages/cloudinit/sources/__init__.py", line 506, in get_vendordata2_raw
      return self.vendordata2_raw
  AttributeError: 'DataSourceNoCloud' object has no attribute 'vendordata2_raw'

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1922739/+subscriptions


References