Harvest commands from the Docker json information and add to the database.

This commit is contained in:
yackob03 2014-01-13 16:32:51 -05:00
parent 5918082e6d
commit e23c750bfb
6 changed files with 38 additions and 8 deletions

View file

@ -167,6 +167,7 @@ class Image(BaseModel):
checksum = CharField(null=True)
created = DateTimeField(null=True)
comment = TextField(null=True)
command = TextField(null=True)
repository = ForeignKeyField(Repository)
image_size = BigIntegerField(null=True)

View file

@ -727,7 +727,7 @@ def set_image_size(docker_image_id, namespace_name, repository_name, image_size)
def set_image_metadata(docker_image_id, namespace_name, repository_name,
created_date_str, comment, parent=None):
created_date_str, comment, command, parent=None):
joined = Image.select().join(Repository)
image_list = list(joined.where(Repository.name == repository_name,
Repository.namespace == namespace_name,
@ -739,6 +739,7 @@ def set_image_metadata(docker_image_id, namespace_name, repository_name,
fetched = image_list[0]
fetched.created = dateutil.parser.parse(created_date_str)
fetched.comment = comment
fetched.command = command
if parent:
fetched.ancestors = '%s%s/' % (parent.ancestors, parent.id)