manifest: remove Content field from manifest
Do not expose the content of the manifest statically and instead rely on the public methods to retrieve source specifications dynamically. Since the methods require iterating through the pipelines to collect source specifications, we should avoid calling the function multiple times when we can reuse the returned values.
This commit is contained in:
parent
cecbc97e06
commit
5dba246813
20 changed files with 45 additions and 82 deletions
|
|
@ -2521,7 +2521,7 @@ func (api *API) composeHandler(writer http.ResponseWriter, request *http.Request
|
|||
return
|
||||
}
|
||||
|
||||
packageSets, err := api.depsolve(manifest.Content.PackageSets, imageType.Arch().Distro())
|
||||
packageSets, err := api.depsolve(manifest.GetPackageSetChains(), imageType.Arch().Distro())
|
||||
if err != nil {
|
||||
errors := responseError{
|
||||
ID: "DepsolveError",
|
||||
|
|
@ -2531,7 +2531,7 @@ func (api *API) composeHandler(writer http.ResponseWriter, request *http.Request
|
|||
return
|
||||
}
|
||||
|
||||
containerSpecs, err := api.resolveContainers(manifest.Content.Containers)
|
||||
containerSpecs, err := api.resolveContainers(manifest.GetContainerSourceSpecs())
|
||||
if err != nil {
|
||||
errors := responseError{
|
||||
ID: "ContainerResolveError",
|
||||
|
|
@ -2543,7 +2543,7 @@ func (api *API) composeHandler(writer http.ResponseWriter, request *http.Request
|
|||
|
||||
testMode := q.Get("test")
|
||||
|
||||
ostreeCommitSpecs, err := api.resolveOSTreeCommits(manifest.Content.OSTreeCommits, testMode == "1" || testMode == "2")
|
||||
ostreeCommitSpecs, err := api.resolveOSTreeCommits(manifest.GetOSTreeSourceSpecs(), testMode == "1" || testMode == "2")
|
||||
if err != nil {
|
||||
errors := responseError{
|
||||
ID: "OSTreeOptionsError",
|
||||
|
|
|
|||
|
|
@ -894,7 +894,7 @@ func TestCompose(t *testing.T) {
|
|||
manifest, _, err := imgType.Manifest(nil, distro.ImageOptions{}, nil, 0)
|
||||
require.NoError(t, err)
|
||||
|
||||
rPkgs, rContainers, rCommits := test_distro.ResolveContent(manifest.Content.PackageSets, manifest.Content.Containers, manifest.Content.OSTreeCommits)
|
||||
rPkgs, rContainers, rCommits := test_distro.ResolveContent(manifest.GetPackageSetChains(), manifest.GetContainerSourceSpecs(), manifest.GetOSTreeSourceSpecs())
|
||||
|
||||
mf, err := manifest.Serialize(rPkgs, rContainers, rCommits)
|
||||
require.NoError(t, err)
|
||||
|
|
@ -905,7 +905,7 @@ func TestCompose(t *testing.T) {
|
|||
ostreeManifest, _, err := ostreeImgType.Manifest(nil, distro.ImageOptions{OSTree: &ostreeOptions}, nil, 0)
|
||||
require.NoError(t, err)
|
||||
|
||||
rPkgs, rContainers, rCommits = test_distro.ResolveContent(ostreeManifest.Content.PackageSets, ostreeManifest.Content.Containers, ostreeManifest.Content.OSTreeCommits)
|
||||
rPkgs, rContainers, rCommits = test_distro.ResolveContent(ostreeManifest.GetPackageSetChains(), ostreeManifest.GetContainerSourceSpecs(), ostreeManifest.GetOSTreeSourceSpecs())
|
||||
|
||||
omf, err := ostreeManifest.Serialize(rPkgs, rContainers, rCommits)
|
||||
require.NoError(t, err)
|
||||
|
|
@ -1013,7 +1013,7 @@ func TestCompose(t *testing.T) {
|
|||
ostreeManifestOther, _, err := ostreeImgType.Manifest(nil, distro.ImageOptions{OSTree: &ostreeOptionsOther}, nil, 0)
|
||||
require.NoError(t, err)
|
||||
|
||||
rPkgs, rContainers, rCommits = test_distro.ResolveContent(ostreeManifestOther.Content.PackageSets, ostreeManifestOther.Content.Containers, ostreeManifestOther.Content.OSTreeCommits)
|
||||
rPkgs, rContainers, rCommits = test_distro.ResolveContent(ostreeManifestOther.GetPackageSetChains(), ostreeManifestOther.GetContainerSourceSpecs(), ostreeManifestOther.GetOSTreeSourceSpecs())
|
||||
|
||||
omfo, err := ostreeManifest.Serialize(rPkgs, rContainers, rCommits)
|
||||
require.NoError(t, err)
|
||||
|
|
@ -1053,7 +1053,7 @@ func TestCompose(t *testing.T) {
|
|||
manifest2, _, err := imgType.Manifest(nil, distro.ImageOptions{}, nil, 0)
|
||||
require.NoError(t, err)
|
||||
|
||||
rPkgs, rContainers, rCommits = test_distro.ResolveContent(manifest2.Content.PackageSets, manifest2.Content.Containers, manifest2.Content.OSTreeCommits)
|
||||
rPkgs, rContainers, rCommits = test_distro.ResolveContent(manifest2.GetPackageSetChains(), manifest2.GetContainerSourceSpecs(), manifest2.GetOSTreeSourceSpecs())
|
||||
mf2, err := manifest2.Serialize(rPkgs, rContainers, rCommits)
|
||||
require.NoError(t, err)
|
||||
|
||||
|
|
@ -2043,7 +2043,7 @@ func TestComposePOST_ImageTypeDenylist(t *testing.T) {
|
|||
manifest, _, err := imgType.Manifest(nil, distro.ImageOptions{}, nil, 0)
|
||||
require.NoError(t, err)
|
||||
|
||||
rPkgs, rContainers, rCommits := test_distro.ResolveContent(manifest.Content.PackageSets, manifest.Content.Containers, manifest.Content.OSTreeCommits)
|
||||
rPkgs, rContainers, rCommits := test_distro.ResolveContent(manifest.GetPackageSetChains(), manifest.GetContainerSourceSpecs(), manifest.GetOSTreeSourceSpecs())
|
||||
mf, err := manifest.Serialize(rPkgs, rContainers, rCommits)
|
||||
require.NoError(t, err)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue