Add migration warning and option to migrate to labels.

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
This commit is contained in:
Daniel Nephin 2015-05-09 12:53:59 -04:00
commit 62059d55e6
7 changed files with 148 additions and 29 deletions

View file

@ -64,7 +64,11 @@ class Container(object):
@property
def number(self):
return int(self.labels.get(LABEL_CONTAINER_NUMBER) or 0)
number = self.labels.get(LABEL_CONTAINER_NUMBER)
if not number:
raise ValueError("Container {0} does not have a {1} label".format(
self.short_id, LABEL_CONTAINER_NUMBER))
return int(number)
@property
def ports(self):