DataSourceSmartOS list() should always return a list

Bug #1763480 reported by Mike Gerdts
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init
Fix Released
Medium
Mike Gerdts

Bug Description

If customer_metadata is empty, a stack trace is seen on the console:

2018-04-12 16:01:18,302 - DataSourceSmartOS.py[DEBUG]: Writing "V2 13 d8094091 1055c865 KEYS
" to metadata transport.
2018-04-12 16:01:18,382 - DataSourceSmartOS.py[DEBUG]: Read "V2 16 b23eb5d0 1055c865 SUCCESS" from metadata transport.
2018-04-12 16:01:18,382 - DataSourceSmartOS.py[DEBUG]: No value found.
2018-04-12 16:01:18,382 - handlers.py[DEBUG]: finish: init-local/search-SmartOS: FAIL: no local data found from DataSourceSmartOS
2018-04-12 16:01:18,382 - util.py[WARNING]: Getting data from <class 'cloudinit.sources.DataSourceSmartOS.DataSourceSmartOS'> failed
2018-04-12 16:01:18,382 - util.py[DEBUG]: Getting data from <class 'cloudinit.sources.DataSourceSmartOS.DataSourceSmartOS'> failed
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/cloudinit/sources/__init__.py", line 447, in find_source
    if s.get_data():
  File "/usr/lib/python3/dist-packages/cloudinit/sources/__init__.py", line 121, in get_data
    return_value = self._get_data()
  File "/usr/lib/python3/dist-packages/cloudinit/sources/DataSourceSmartOS.py", line 238, in _get_data
    md[ci_noun] = self.md_client.get(smartos_noun, strip=strip)
  File "/usr/lib/python3/dist-packages/cloudinit/sources/DataSourceSmartOS.py", line 640, in get
    if self.is_b64_encoded(key):
  File "/usr/lib/python3/dist-packages/cloudinit/sources/DataSourceSmartOS.py", line 628, in is_b64_encoded
    self._init_base64_keys(reset=reset)
  File "/usr/lib/python3/dist-packages/cloudinit/sources/DataSourceSmartOS.py", line 594, in _init_base64_keys
    if 'base64_all' in keys:
TypeError: argument of type 'NoneType' is not iterable
2018-04-12 16:01:18,391 - main.py[DEBUG]: No local datasource found

To reproduce:

# vmadm create <<EOF
{
  "alias": "ci",
  "brand": "bhyve",
  "ram": "1024",
  "vcpus": "2",
  "disks": [
    {
      "image_uuid": "4260219e-09d7-c1b3-908c-947839b1d10c",
      "boot": true,
      "model": "virtio"
    }
  ]
}
EOF

As the zone boots, the errors shown above will appear on the console. If using a SmartOS platform image that has a date stamp of 20180412 or later, this information will be visible in /zones/$uuid/logs/console.log. The image uuid above is a custom image I created based on the Ubuntu certified 16.04 image.

Related branches

Mike Gerdts (mgerdts)
Changed in cloud-init:
assignee: nobody → Mike Gerdts (mgerdts)
Revision history for this message
Mike Gerdts (mgerdts) wrote :

A clarification: the error messages were in cloud-init.log. I found it in the console log only after I had been viewing that log on the console. But that's not really the important part of this.

Scott Moser (smoser)
Changed in cloud-init:
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Scott Moser (smoser) wrote :

An upstream commit landed for this bug.

To view that commit see the following URL:
https://git.launchpad.net/cloud-init/commit/?id=8e111502

Changed in cloud-init:
status: Confirmed → Fix Committed
Revision history for this message
Scott Moser (smoser) wrote : Fixed in cloud-init version 18.3.

This bug is believed to be fixed in cloud-init in version 18.3. If this is still a problem for you, please make a comment and set the state back to New

Thank you.

Changed in cloud-init:
status: Fix Committed → Fix Released
Revision history for this message
James Falcon (falcojr) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.