Implemented checksum computation on image creation (necessary for new push primitive)

This commit is contained in:
shin-
2013-05-06 10:52:42 -07:00
parent 7c1a27e2ad
commit 048fd671ef
3 changed files with 20 additions and 4 deletions
+6 -4
View File
@@ -98,11 +98,13 @@ func (graph *Graph) Create(layerData Archive, container *Container, comment, aut
img.Parent = container.Image
img.Container = container.Id
img.ContainerConfig = *container.Config
if config == nil {
if parentImage, err := graph.Get(container.Image); err == nil && parentImage != nil {
img.Config = parentImage.Config
}
// FIXME: If an image is pulled from a raw URL (not created from a container),
// its checksum will not be computed, which will cause a push to fail
checksum, err := container.RwChecksum()
if err != nil {
return nil, err
}
img.Checksum = checksum
}
if err := graph.Register(layerData, img); err != nil {
return nil, err