nova client breaks if object has None for name

Bug #1267130 reported by Gavin B
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-novaclient
Fix Released
Undecided
Unassigned

Bug Description

On one of our test systems we've managed to get some images that have no name. This doesn't worry the glance client, and didn't worry nova client either until recently, but now it's broken.

(toto)gavinstbjenkins1 gavin@gbhpcs ~/tmp $ nova image-list
ERROR: <type 'NoneType'> can't be decoded

I've narrowed it down to a recent code change :

Author: Chris Buccella <email address hidden> 2014-01-04 23:56:09
Committer: Chris Buccella <email address hidden> 2014-01-04 23:56:09
Parent: ab32e406c80c14aa9b7aaf13d1678b168b8272a4 (Merge "Replace some utils.bool_from_str with strutils")
Child: 77a9574238d416b59b7d38ca69fc7ca22c1479b6 (Merge "Code cleanup: use oslo's to_slug() instead of slugify()")

@@ -442,7 +442,7 @@ class Resource(object):
         for bash completion.
         """
         if self.NAME_ATTR in self.__dict__ and self.HUMAN_ID:
- return utils.slugify(getattr(self, self.NAME_ATTR))
+ return strutils.to_slug(getattr(self, self.NAME_ATTR))
         return None

Which breaks if any object has a name attribute set to None.

Revision history for this message
Gavin B (gavin-brebner-orange) wrote :

managed to miss the sha tag for the change that broke it : 3dbab161bed7659eb976f0961ae5226da34b16f9

Revision history for this message
Gavin B (gavin-brebner-orange) wrote :

I have a fix to propose ... will submit shortly

Revision history for this message
Gavin B (gavin-brebner-orange) wrote :
Revision history for this message
Alexis Lee (alexisl) wrote :

This has a neater solution IMHO: https://review.openstack.org/#/c/65665/

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-novaclient (master)

Reviewed: https://review.openstack.org/65665
Committed: https://git.openstack.org/cgit/openstack/python-novaclient/commit/?id=3c9a3d8d32491814869f663cc40729bcb4e4687c
Submitter: Jenkins
Branch: master

commit 3c9a3d8d32491814869f663cc40729bcb4e4687c
Author: Roman Rader <email address hidden>
Date: Thu Jan 9 13:12:29 2014 +0200

    Don't slugify() None names

    If image has no name, human_id can't be built.
    Also slugify raises ValueError if None argument passed.
    It affects Docker images.

    Closes-Bug: #1267429
    Closes-Bug: #1267130
    Change-Id: Ib975775b441917eef2a650049cee9991d10c50d7

Changed in python-novaclient:
status: New → Fix Committed
Revision history for this message
Daniel Kuffner (daniel-kuffner) wrote :

I can get the nova list but I cannot boot an docker instance:

nova boot --image centos:latest --flavor m1.tiny centos1
ERROR: <type 'NoneType'> can't be decoded

Is that related? Another bug?

Revision history for this message
melanie witt (melwitt) wrote :

novaclient 2.16.0 released on 2/26/2014

Changed in python-novaclient:
status: Fix Committed → Fix Released
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.