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
This commit is contained in:
Roman Rader 2014-01-09 13:12:29 +02:00
parent 77a9574238
commit 3c9a3d8d32
1 changed files with 3 additions and 1 deletions

View File

@ -442,7 +442,9 @@ class Resource(object):
for bash completion.
"""
if self.NAME_ATTR in self.__dict__ and self.HUMAN_ID:
return strutils.to_slug(getattr(self, self.NAME_ATTR))
name = getattr(self, self.NAME_ATTR)
if name is not None:
return strutils.to_slug(name)
return None
def _add_details(self, info):