Move rename functionality into Container

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
This commit is contained in:
Mazz Mosley 2015-10-27 11:55:35 +00:00
commit 30a84f1be6
2 changed files with 10 additions and 8 deletions

View file

@ -192,6 +192,15 @@ class Container(object):
def remove(self, **options):
return self.client.remove_container(self.id, **options)
def rename_to_tmp_name(self):
"""Rename the container to a hopefully unique temporary container name
by prepending the short id.
"""
self.client.rename(
self.id,
'%s_%s' % (self.short_id, self.name)
)
def inspect_if_not_inspected(self):
if not self.has_been_inspected:
self.inspect()