store: fetch checksums for requested repositories

previously these were provided, but in case of RCM API they are not,
therefore we fetch them automatically
This commit is contained in:
Martin Sehnoutka 2020-02-14 15:06:39 +01:00 committed by Tom Gundersen
parent e791f51e2e
commit 2f0eed14c6

View file

@ -599,16 +599,25 @@ func (s *Store) PushComposeRequest(request common.ComposeRequest) error {
panic("Multiple image requests are not yet properly implemented")
}
// map( repo-id => checksum )
checksums := make(map[string]string)
for _, repo := range request.Repositories {
checksum, err := repo.FetchChecksum()
if err != nil {
return err
}
checksums[repo.Id] = checksum
}
for imageBuildID, imageRequest := range request.RequestedImages {
// TODO: handle custom upload targets
// TODO: this requires changes in the Compose Request struct
// TODO: implment support for no checksums
// This should never happen and once distro.Pipeline is refactored this check will go away
imgTypeCompatStr, exists := imageRequest.ImgType.ToCompatString()
if !exists {
panic("fatal error, image type should exist but it does not")
}
pipelineStruct, err := distroStruct.Pipeline(&request.Blueprint, request.Repositories, nil, nil, nil, arch, imgTypeCompatStr, 0)
pipelineStruct, err := distroStruct.Pipeline(&request.Blueprint, request.Repositories, nil, nil, checksums, arch, imgTypeCompatStr, 0)
if err != nil {
return err
}