rpmmd/repository: repoconfig pointers
Convert some of the fields in the `RepoConfig` struct to pointers. Since `RepoConfig` will be used to convert custom repositories to an array of `osbuild.YumRepository`, we need to ensure that fields that are not set explicitly are not saved to the `/etc/yum.repos.d` repository files.
This commit is contained in:
parent
75e2138878
commit
d44703cdc8
14 changed files with 78 additions and 51 deletions
|
|
@ -17,6 +17,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/osbuild/osbuild-composer/internal/blueprint"
|
"github.com/osbuild/osbuild-composer/internal/blueprint"
|
||||||
|
"github.com/osbuild/osbuild-composer/internal/common"
|
||||||
"github.com/osbuild/osbuild-composer/internal/container"
|
"github.com/osbuild/osbuild-composer/internal/container"
|
||||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||||
"github.com/osbuild/osbuild-composer/internal/distroregistry"
|
"github.com/osbuild/osbuild-composer/internal/distroregistry"
|
||||||
|
|
@ -203,8 +204,8 @@ func convertRepo(r repository) rpmmd.RepoConfig {
|
||||||
Metalink: r.Metalink,
|
Metalink: r.Metalink,
|
||||||
MirrorList: r.MirrorList,
|
MirrorList: r.MirrorList,
|
||||||
GPGKeys: keys,
|
GPGKeys: keys,
|
||||||
CheckGPG: r.CheckGPG,
|
CheckGPG: &r.CheckGPG,
|
||||||
CheckRepoGPG: false,
|
CheckRepoGPG: common.ToPtr(false),
|
||||||
IgnoreSSL: false,
|
IgnoreSSL: false,
|
||||||
MetadataExpire: r.MetadataExpire,
|
MetadataExpire: r.MetadataExpire,
|
||||||
RHSM: r.RHSM,
|
RHSM: r.RHSM,
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
|
||||||
|
"github.com/osbuild/osbuild-composer/internal/common"
|
||||||
"github.com/osbuild/osbuild-composer/internal/container"
|
"github.com/osbuild/osbuild-composer/internal/container"
|
||||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||||
"github.com/osbuild/osbuild-composer/internal/distroregistry"
|
"github.com/osbuild/osbuild-composer/internal/distroregistry"
|
||||||
|
|
@ -149,14 +150,16 @@ func main() {
|
||||||
keys = []string{repo.GPGKey}
|
keys = []string{repo.GPGKey}
|
||||||
}
|
}
|
||||||
repos[i] = rpmmd.RepoConfig{
|
repos[i] = rpmmd.RepoConfig{
|
||||||
Name: repoName,
|
Name: repoName,
|
||||||
BaseURLs: urls,
|
BaseURLs: urls,
|
||||||
Metalink: repo.Metalink,
|
Metalink: repo.Metalink,
|
||||||
MirrorList: repo.MirrorList,
|
MirrorList: repo.MirrorList,
|
||||||
GPGKeys: keys,
|
GPGKeys: keys,
|
||||||
CheckGPG: repo.CheckGPG,
|
CheckGPG: &repo.CheckGPG,
|
||||||
PackageSets: repo.PackageSets,
|
CheckRepoGPG: common.ToPtr(false),
|
||||||
RHSM: repo.RHSM,
|
IgnoreSSL: false,
|
||||||
|
PackageSets: repo.PackageSets,
|
||||||
|
RHSM: repo.RHSM,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/osbuild/osbuild-composer/internal/common"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1363,7 +1363,7 @@ func genRepoConfig(repo Repository) (*rpmmd.RepoConfig, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if repo.CheckGpg != nil {
|
if repo.CheckGpg != nil {
|
||||||
repoConfig.CheckGPG = *repo.CheckGpg
|
repoConfig.CheckGPG = repo.CheckGpg
|
||||||
}
|
}
|
||||||
if repo.Gpgkey != nil && *repo.Gpgkey != "" {
|
if repo.Gpgkey != nil && *repo.Gpgkey != "" {
|
||||||
repoConfig.GPGKeys = []string{*repo.Gpgkey}
|
repoConfig.GPGKeys = []string{*repo.Gpgkey}
|
||||||
|
|
@ -1372,10 +1372,10 @@ func genRepoConfig(repo Repository) (*rpmmd.RepoConfig, error) {
|
||||||
repoConfig.IgnoreSSL = *repo.IgnoreSsl
|
repoConfig.IgnoreSSL = *repo.IgnoreSsl
|
||||||
}
|
}
|
||||||
if repo.CheckRepoGpg != nil {
|
if repo.CheckRepoGpg != nil {
|
||||||
repoConfig.CheckRepoGPG = *repo.CheckRepoGpg
|
repoConfig.CheckRepoGPG = repo.CheckRepoGpg
|
||||||
}
|
}
|
||||||
|
|
||||||
if repoConfig.CheckGPG && len(repoConfig.GPGKeys) == 0 {
|
if repoConfig.CheckGPG != nil && *repoConfig.CheckGPG && len(repoConfig.GPGKeys) == 0 {
|
||||||
return nil, HTTPError(ErrorNoGPGKey)
|
return nil, HTTPError(ErrorNoGPGKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ func TestRepoConfigConversion(t *testing.T) {
|
||||||
Metalink: "",
|
Metalink: "",
|
||||||
MirrorList: "",
|
MirrorList: "",
|
||||||
GPGKeys: []string{"some-kind-of-key"},
|
GPGKeys: []string{"some-kind-of-key"},
|
||||||
CheckGPG: true,
|
CheckGPG: common.ToPtr(true),
|
||||||
IgnoreSSL: false,
|
IgnoreSSL: false,
|
||||||
MetadataExpire: "",
|
MetadataExpire: "",
|
||||||
RHSM: false,
|
RHSM: false,
|
||||||
|
|
@ -131,7 +131,7 @@ func TestRepoConfigConversion(t *testing.T) {
|
||||||
BaseURLs: []string{"http://base.url"},
|
BaseURLs: []string{"http://base.url"},
|
||||||
Metalink: "", // since BaseURL is specified, MetaLink is not copied
|
Metalink: "", // since BaseURL is specified, MetaLink is not copied
|
||||||
MirrorList: "", // since BaseURL is specified, MirrorList is not copied
|
MirrorList: "", // since BaseURL is specified, MirrorList is not copied
|
||||||
CheckGPG: false,
|
CheckGPG: nil,
|
||||||
IgnoreSSL: true,
|
IgnoreSSL: true,
|
||||||
MetadataExpire: "",
|
MetadataExpire: "",
|
||||||
RHSM: false,
|
RHSM: false,
|
||||||
|
|
@ -153,7 +153,7 @@ func TestRepoConfigConversion(t *testing.T) {
|
||||||
Name: "",
|
Name: "",
|
||||||
Metalink: "", // since MirrorList is specified, MetaLink is not copied
|
Metalink: "", // since MirrorList is specified, MetaLink is not copied
|
||||||
MirrorList: "http://example.org/mirrorlist",
|
MirrorList: "http://example.org/mirrorlist",
|
||||||
CheckGPG: false,
|
CheckGPG: nil,
|
||||||
IgnoreSSL: true,
|
IgnoreSSL: true,
|
||||||
MetadataExpire: "",
|
MetadataExpire: "",
|
||||||
RHSM: false,
|
RHSM: false,
|
||||||
|
|
@ -175,7 +175,7 @@ func TestRepoConfigConversion(t *testing.T) {
|
||||||
Name: "",
|
Name: "",
|
||||||
Metalink: "http://example.org/metalink",
|
Metalink: "http://example.org/metalink",
|
||||||
MirrorList: "",
|
MirrorList: "",
|
||||||
CheckGPG: false,
|
CheckGPG: nil,
|
||||||
IgnoreSSL: true,
|
IgnoreSSL: true,
|
||||||
MetadataExpire: "",
|
MetadataExpire: "",
|
||||||
RHSM: true,
|
RHSM: true,
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/osbuild/osbuild-composer/internal/blueprint"
|
"github.com/osbuild/osbuild-composer/internal/blueprint"
|
||||||
|
"github.com/osbuild/osbuild-composer/internal/common"
|
||||||
"github.com/osbuild/osbuild-composer/internal/container"
|
"github.com/osbuild/osbuild-composer/internal/container"
|
||||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||||
"github.com/osbuild/osbuild-composer/internal/distro/distro_test_common"
|
"github.com/osbuild/osbuild-composer/internal/distro/distro_test_common"
|
||||||
|
|
@ -203,7 +204,7 @@ func TestImageTypePipelineNames(t *testing.T) {
|
||||||
BaseURLs: []string{"http://payload.example.com"},
|
BaseURLs: []string{"http://payload.example.com"},
|
||||||
PackageSets: imageType.PayloadPackageSets(),
|
PackageSets: imageType.PayloadPackageSets(),
|
||||||
GPGKeys: []string{"payload-gpg-key"},
|
GPGKeys: []string{"payload-gpg-key"},
|
||||||
CheckGPG: true,
|
CheckGPG: common.ToPtr(true),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
containers := make([]container.Spec, 0)
|
containers := make([]container.Spec, 0)
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import (
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/osbuild/osbuild-composer/internal/blueprint"
|
"github.com/osbuild/osbuild-composer/internal/blueprint"
|
||||||
|
"github.com/osbuild/osbuild-composer/internal/common"
|
||||||
"github.com/osbuild/osbuild-composer/internal/container"
|
"github.com/osbuild/osbuild-composer/internal/container"
|
||||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||||
"github.com/osbuild/osbuild-composer/internal/distroregistry"
|
"github.com/osbuild/osbuild-composer/internal/distroregistry"
|
||||||
|
|
@ -76,7 +77,7 @@ func TestDistro_Manifest(t *testing.T, pipelinePath string, prefix string, regis
|
||||||
Metalink: repo.Metalink,
|
Metalink: repo.Metalink,
|
||||||
MirrorList: repo.MirrorList,
|
MirrorList: repo.MirrorList,
|
||||||
GPGKeys: keys,
|
GPGKeys: keys,
|
||||||
CheckGPG: repo.CheckGPG,
|
CheckGPG: common.ToPtr(repo.CheckGPG),
|
||||||
PackageSets: repo.PackageSets,
|
PackageSets: repo.PackageSets,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -266,11 +266,18 @@ func (s *Solver) reposFromRPMMD(rpmRepos []rpmmd.RepoConfig) ([]repoConfig, erro
|
||||||
Metalink: rr.Metalink,
|
Metalink: rr.Metalink,
|
||||||
MirrorList: rr.MirrorList,
|
MirrorList: rr.MirrorList,
|
||||||
GPGKeys: rr.GPGKeys,
|
GPGKeys: rr.GPGKeys,
|
||||||
CheckGPG: rr.CheckGPG,
|
|
||||||
CheckRepoGPG: rr.CheckRepoGPG,
|
|
||||||
IgnoreSSL: rr.IgnoreSSL,
|
IgnoreSSL: rr.IgnoreSSL,
|
||||||
MetadataExpire: rr.MetadataExpire,
|
MetadataExpire: rr.MetadataExpire,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if rr.CheckGPG != nil {
|
||||||
|
dr.CheckGPG = *rr.CheckGPG
|
||||||
|
}
|
||||||
|
|
||||||
|
if rr.CheckRepoGPG != nil {
|
||||||
|
dr.CheckRepoGPG = *rr.CheckRepoGPG
|
||||||
|
}
|
||||||
|
|
||||||
if rr.RHSM {
|
if rr.RHSM {
|
||||||
if s.subscriptions == nil {
|
if s.subscriptions == nil {
|
||||||
return nil, fmt.Errorf("This system does not have any valid subscriptions. Subscribe it before specifying rhsm: true in sources.")
|
return nil, fmt.Errorf("This system does not have any valid subscriptions. Subscribe it before specifying rhsm: true in sources.")
|
||||||
|
|
@ -457,7 +464,9 @@ func (pkgs packageSpecs) toRPMMD(repos map[string]rpmmd.RepoConfig) []rpmmd.Pack
|
||||||
rpmDependencies[i].Arch = dep.Arch
|
rpmDependencies[i].Arch = dep.Arch
|
||||||
rpmDependencies[i].RemoteLocation = dep.RemoteLocation
|
rpmDependencies[i].RemoteLocation = dep.RemoteLocation
|
||||||
rpmDependencies[i].Checksum = dep.Checksum
|
rpmDependencies[i].Checksum = dep.Checksum
|
||||||
rpmDependencies[i].CheckGPG = repo.CheckGPG
|
if repo.CheckGPG != nil {
|
||||||
|
rpmDependencies[i].CheckGPG = *repo.CheckGPG
|
||||||
|
}
|
||||||
rpmDependencies[i].IgnoreSSL = repo.IgnoreSSL
|
rpmDependencies[i].IgnoreSSL = repo.IgnoreSSL
|
||||||
if repo.RHSM {
|
if repo.RHSM {
|
||||||
rpmDependencies[i].Secrets = "org.osbuild.rhsm"
|
rpmDependencies[i].Secrets = "org.osbuild.rhsm"
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/osbuild/osbuild-composer/internal/common"
|
||||||
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -19,7 +20,7 @@ func NewTestServer() *testRepoServer {
|
||||||
testrepo := rpmmd.RepoConfig{
|
testrepo := rpmmd.RepoConfig{
|
||||||
Name: "cs9-baseos",
|
Name: "cs9-baseos",
|
||||||
BaseURLs: []string{server.URL},
|
BaseURLs: []string{server.URL},
|
||||||
CheckGPG: false,
|
CheckGPG: common.ToPtr(false),
|
||||||
IgnoreSSL: true,
|
IgnoreSSL: true,
|
||||||
RHSM: false,
|
RHSM: false,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,8 @@ type RepoConfig struct {
|
||||||
Metalink string `json:"metalink,omitempty"`
|
Metalink string `json:"metalink,omitempty"`
|
||||||
MirrorList string `json:"mirrorlist,omitempty"`
|
MirrorList string `json:"mirrorlist,omitempty"`
|
||||||
GPGKeys []string `json:"gpgkeys,omitempty"`
|
GPGKeys []string `json:"gpgkeys,omitempty"`
|
||||||
CheckGPG bool `json:"check_gpg,omitempty"`
|
CheckGPG *bool `json:"check_gpg,omitempty"`
|
||||||
CheckRepoGPG bool `json:"check_repo_gpg,omitempty"`
|
CheckRepoGPG *bool `json:"check_repo_gpg,omitempty"`
|
||||||
IgnoreSSL bool `json:"ignore_ssl,omitempty"`
|
IgnoreSSL bool `json:"ignore_ssl,omitempty"`
|
||||||
MetadataExpire string `json:"metadata_expire,omitempty"`
|
MetadataExpire string `json:"metadata_expire,omitempty"`
|
||||||
RHSM bool `json:"rhsm,omitempty"`
|
RHSM bool `json:"rhsm,omitempty"`
|
||||||
|
|
@ -49,6 +49,9 @@ func (r *RepoConfig) Hash() string {
|
||||||
bts := func(b bool) string {
|
bts := func(b bool) string {
|
||||||
return fmt.Sprintf("%T", b)
|
return fmt.Sprintf("%T", b)
|
||||||
}
|
}
|
||||||
|
bpts := func(b *bool) string {
|
||||||
|
return fmt.Sprintf("%T", b)
|
||||||
|
}
|
||||||
ats := func(s []string) string {
|
ats := func(s []string) string {
|
||||||
return strings.Join(s, "")
|
return strings.Join(s, "")
|
||||||
}
|
}
|
||||||
|
|
@ -56,8 +59,8 @@ func (r *RepoConfig) Hash() string {
|
||||||
r.Metalink+
|
r.Metalink+
|
||||||
r.MirrorList+
|
r.MirrorList+
|
||||||
ats(r.GPGKeys)+
|
ats(r.GPGKeys)+
|
||||||
bts(r.CheckGPG)+
|
bpts(r.CheckGPG)+
|
||||||
bts(r.CheckRepoGPG)+
|
bpts(r.CheckRepoGPG)+
|
||||||
bts(r.IgnoreSSL)+
|
bts(r.IgnoreSSL)+
|
||||||
r.MetadataExpire+
|
r.MetadataExpire+
|
||||||
bts(r.RHSM))))
|
bts(r.RHSM))))
|
||||||
|
|
@ -237,7 +240,7 @@ func loadRepositoriesFromFile(filename string) (map[string][]RepoConfig, error)
|
||||||
Metalink: repo.Metalink,
|
Metalink: repo.Metalink,
|
||||||
MirrorList: repo.MirrorList,
|
MirrorList: repo.MirrorList,
|
||||||
GPGKeys: keys,
|
GPGKeys: keys,
|
||||||
CheckGPG: repo.CheckGPG,
|
CheckGPG: &repo.CheckGPG,
|
||||||
RHSM: repo.RHSM,
|
RHSM: repo.RHSM,
|
||||||
MetadataExpire: repo.MetadataExpire,
|
MetadataExpire: repo.MetadataExpire,
|
||||||
ImageTypeTags: repo.ImageTypeTags,
|
ImageTypeTags: repo.ImageTypeTags,
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/osbuild/osbuild-composer/internal/common"
|
||||||
"github.com/osbuild/osbuild-composer/internal/distro/test_distro"
|
"github.com/osbuild/osbuild-composer/internal/distro/test_distro"
|
||||||
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
@ -218,8 +219,8 @@ func TestOldWorkerRepositoryCompatUnmarshal(t *testing.T) {
|
||||||
Metalink: "http://example.com/metalink",
|
Metalink: "http://example.com/metalink",
|
||||||
MirrorList: "http://example.com/mirrorlist",
|
MirrorList: "http://example.com/mirrorlist",
|
||||||
GPGKeys: []string{"key1", "key2"},
|
GPGKeys: []string{"key1", "key2"},
|
||||||
CheckGPG: true,
|
CheckGPG: common.ToPtr(true),
|
||||||
CheckRepoGPG: true,
|
CheckRepoGPG: common.ToPtr(true),
|
||||||
IgnoreSSL: true,
|
IgnoreSSL: true,
|
||||||
MetadataExpire: "test",
|
MetadataExpire: "test",
|
||||||
RHSM: true,
|
RHSM: true,
|
||||||
|
|
@ -266,8 +267,8 @@ func TestOldWorkerRepositoryCompatMarshal(t *testing.T) {
|
||||||
Metalink: "http://example.com/metalink",
|
Metalink: "http://example.com/metalink",
|
||||||
MirrorList: "http://example.com/mirrorlist",
|
MirrorList: "http://example.com/mirrorlist",
|
||||||
GPGKeys: []string{"key1", "key2"},
|
GPGKeys: []string{"key1", "key2"},
|
||||||
CheckGPG: true,
|
CheckGPG: common.ToPtr(true),
|
||||||
CheckRepoGPG: true,
|
CheckRepoGPG: common.ToPtr(true),
|
||||||
IgnoreSSL: true,
|
IgnoreSSL: true,
|
||||||
MetadataExpire: "test",
|
MetadataExpire: "test",
|
||||||
RHSM: true,
|
RHSM: true,
|
||||||
|
|
|
||||||
|
|
@ -582,13 +582,19 @@ func (s *Store) GetAllDistroSources(distro string) map[string]SourceConfig {
|
||||||
|
|
||||||
func NewSourceConfig(repo rpmmd.RepoConfig, system bool) SourceConfig {
|
func NewSourceConfig(repo rpmmd.RepoConfig, system bool) SourceConfig {
|
||||||
sc := SourceConfig{
|
sc := SourceConfig{
|
||||||
Name: repo.Name,
|
Name: repo.Name,
|
||||||
CheckGPG: repo.CheckGPG,
|
System: system,
|
||||||
CheckSSL: !repo.IgnoreSSL,
|
RHSM: repo.RHSM,
|
||||||
System: system,
|
GPGKeys: repo.GPGKeys,
|
||||||
RHSM: repo.RHSM,
|
CheckSSL: !repo.IgnoreSSL,
|
||||||
CheckRepoGPG: repo.CheckRepoGPG,
|
}
|
||||||
GPGKeys: repo.GPGKeys,
|
|
||||||
|
if repo.CheckGPG != nil {
|
||||||
|
sc.CheckGPG = *repo.CheckGPG
|
||||||
|
}
|
||||||
|
|
||||||
|
if repo.CheckRepoGPG != nil {
|
||||||
|
sc.CheckRepoGPG = *repo.CheckRepoGPG
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(repo.BaseURLs) != 0 {
|
if len(repo.BaseURLs) != 0 {
|
||||||
|
|
@ -610,9 +616,9 @@ func (s *SourceConfig) RepoConfig(name string) rpmmd.RepoConfig {
|
||||||
|
|
||||||
repo.Name = name
|
repo.Name = name
|
||||||
repo.IgnoreSSL = !s.CheckSSL
|
repo.IgnoreSSL = !s.CheckSSL
|
||||||
repo.CheckGPG = s.CheckGPG
|
repo.CheckGPG = &s.CheckGPG
|
||||||
repo.RHSM = s.RHSM
|
repo.RHSM = s.RHSM
|
||||||
repo.CheckRepoGPG = s.CheckRepoGPG
|
repo.CheckRepoGPG = &s.CheckRepoGPG
|
||||||
repo.GPGKeys = s.GPGKeys
|
repo.GPGKeys = s.GPGKeys
|
||||||
|
|
||||||
var urls []string
|
var urls []string
|
||||||
|
|
|
||||||
|
|
@ -422,7 +422,7 @@ func (suite *storeTest) TestNewSourceConfigWithBaseURL() {
|
||||||
myRepoConfig := rpmmd.RepoConfig{
|
myRepoConfig := rpmmd.RepoConfig{
|
||||||
Name: "testRepo",
|
Name: "testRepo",
|
||||||
BaseURLs: []string{"testURL"},
|
BaseURLs: []string{"testURL"},
|
||||||
CheckGPG: true,
|
CheckGPG: common.ToPtr(true),
|
||||||
}
|
}
|
||||||
expectedSource := SourceConfig{Name: "testRepo", Type: "yum-baseurl", URL: "testURL", CheckGPG: true, CheckSSL: true, System: true}
|
expectedSource := SourceConfig{Name: "testRepo", Type: "yum-baseurl", URL: "testURL", CheckGPG: true, CheckSSL: true, System: true}
|
||||||
actualSource := NewSourceConfig(myRepoConfig, true)
|
actualSource := NewSourceConfig(myRepoConfig, true)
|
||||||
|
|
@ -433,7 +433,7 @@ func (suite *storeTest) TestNewSourceConfigWithMetaLink() {
|
||||||
myRepoConfig := rpmmd.RepoConfig{
|
myRepoConfig := rpmmd.RepoConfig{
|
||||||
Name: "testRepo",
|
Name: "testRepo",
|
||||||
Metalink: "testURL",
|
Metalink: "testURL",
|
||||||
CheckGPG: true,
|
CheckGPG: common.ToPtr(true),
|
||||||
}
|
}
|
||||||
expectedSource := SourceConfig{Name: "testRepo", Type: "yum-metalink", URL: "testURL", CheckGPG: true, CheckSSL: true, System: true}
|
expectedSource := SourceConfig{Name: "testRepo", Type: "yum-metalink", URL: "testURL", CheckGPG: true, CheckSSL: true, System: true}
|
||||||
actualSource := NewSourceConfig(myRepoConfig, true)
|
actualSource := NewSourceConfig(myRepoConfig, true)
|
||||||
|
|
@ -452,7 +452,7 @@ func (suite *storeTest) TestNewSourceConfigWithMirrorList() {
|
||||||
|
|
||||||
// Test converting a SourceConfig with GPGkeys to a RepoConfig
|
// Test converting a SourceConfig with GPGkeys to a RepoConfig
|
||||||
func (suite *storeTest) TestRepoConfigGPGKeys() {
|
func (suite *storeTest) TestRepoConfigGPGKeys() {
|
||||||
expectedRepo := rpmmd.RepoConfig{Name: "testSourceConfig", BaseURLs: []string{"testURL"}, Metalink: "", MirrorList: "", IgnoreSSL: true, MetadataExpire: "", CheckRepoGPG: true, GPGKeys: []string{"http://path.to.gpgkeys/key.pub", "-----BEGIN PGP PUBLIC KEY BLOCK-----\nFULL GPG KEY HERE\n-----END PGP PUBLIC KEY BLOCK-----"}}
|
expectedRepo := rpmmd.RepoConfig{Name: "testSourceConfig", BaseURLs: []string{"testURL"}, Metalink: "", MirrorList: "", IgnoreSSL: true, MetadataExpire: "", CheckGPG: common.ToPtr(false), CheckRepoGPG: common.ToPtr(true), GPGKeys: []string{"http://path.to.gpgkeys/key.pub", "-----BEGIN PGP PUBLIC KEY BLOCK-----\nFULL GPG KEY HERE\n-----END PGP PUBLIC KEY BLOCK-----"}}
|
||||||
mySourceConfig := suite.mySourceConfig
|
mySourceConfig := suite.mySourceConfig
|
||||||
mySourceConfig.Type = "yum-baseurl"
|
mySourceConfig.Type = "yum-baseurl"
|
||||||
mySourceConfig.URL = "testURL"
|
mySourceConfig.URL = "testURL"
|
||||||
|
|
@ -463,7 +463,7 @@ func (suite *storeTest) TestRepoConfigGPGKeys() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *storeTest) TestRepoConfigBaseURL() {
|
func (suite *storeTest) TestRepoConfigBaseURL() {
|
||||||
expectedRepo := rpmmd.RepoConfig{Name: "testSourceConfig", BaseURLs: []string{"testURL"}, Metalink: "", MirrorList: "", IgnoreSSL: true, MetadataExpire: ""}
|
expectedRepo := rpmmd.RepoConfig{Name: "testSourceConfig", BaseURLs: []string{"testURL"}, Metalink: "", MirrorList: "", IgnoreSSL: true, CheckGPG: common.ToPtr(false), CheckRepoGPG: common.ToPtr(false), MetadataExpire: ""}
|
||||||
suite.mySourceConfig.Type = "yum-baseurl"
|
suite.mySourceConfig.Type = "yum-baseurl"
|
||||||
suite.mySourceConfig.URL = "testURL"
|
suite.mySourceConfig.URL = "testURL"
|
||||||
actualRepo := suite.mySourceConfig.RepoConfig("testSourceConfig")
|
actualRepo := suite.mySourceConfig.RepoConfig("testSourceConfig")
|
||||||
|
|
@ -471,7 +471,7 @@ func (suite *storeTest) TestRepoConfigBaseURL() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *storeTest) TestRepoConfigMetalink() {
|
func (suite *storeTest) TestRepoConfigMetalink() {
|
||||||
expectedRepo := rpmmd.RepoConfig{Name: "testSourceConfig", Metalink: "testURL", MirrorList: "", IgnoreSSL: true, MetadataExpire: ""}
|
expectedRepo := rpmmd.RepoConfig{Name: "testSourceConfig", Metalink: "testURL", MirrorList: "", IgnoreSSL: true, CheckGPG: common.ToPtr(false), CheckRepoGPG: common.ToPtr(false), MetadataExpire: ""}
|
||||||
suite.mySourceConfig.Type = "yum-metalink"
|
suite.mySourceConfig.Type = "yum-metalink"
|
||||||
suite.mySourceConfig.URL = "testURL"
|
suite.mySourceConfig.URL = "testURL"
|
||||||
actualRepo := suite.mySourceConfig.RepoConfig("testSourceConfig")
|
actualRepo := suite.mySourceConfig.RepoConfig("testSourceConfig")
|
||||||
|
|
@ -479,7 +479,7 @@ func (suite *storeTest) TestRepoConfigMetalink() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *storeTest) TestRepoConfigMirrorlist() {
|
func (suite *storeTest) TestRepoConfigMirrorlist() {
|
||||||
expectedRepo := rpmmd.RepoConfig{Name: "testSourceConfig", Metalink: "", MirrorList: "testURL", IgnoreSSL: true, MetadataExpire: ""}
|
expectedRepo := rpmmd.RepoConfig{Name: "testSourceConfig", Metalink: "", MirrorList: "testURL", IgnoreSSL: true, CheckGPG: common.ToPtr(false), CheckRepoGPG: common.ToPtr(false), MetadataExpire: ""}
|
||||||
suite.mySourceConfig.Type = "yum-mirrorlist"
|
suite.mySourceConfig.Type = "yum-mirrorlist"
|
||||||
suite.mySourceConfig.URL = "testURL"
|
suite.mySourceConfig.URL = "testURL"
|
||||||
actualRepo := suite.mySourceConfig.RepoConfig("testSourceConfig")
|
actualRepo := suite.mySourceConfig.RepoConfig("testSourceConfig")
|
||||||
|
|
|
||||||
|
|
@ -63,12 +63,12 @@ func createWeldrAPI(tempdir string, fixtureGenerator rpmmd_mock.FixtureGenerator
|
||||||
rr := reporegistry.NewFromDistrosRepoConfigs(rpmmd.DistrosRepoConfigs{
|
rr := reporegistry.NewFromDistrosRepoConfigs(rpmmd.DistrosRepoConfigs{
|
||||||
test_distro.TestDistroName: {
|
test_distro.TestDistroName: {
|
||||||
test_distro.TestArchName: {
|
test_distro.TestArchName: {
|
||||||
{Name: "test-id", BaseURLs: []string{"http://example.com/test/os/x86_64"}, CheckGPG: true},
|
{Name: "test-id", BaseURLs: []string{"http://example.com/test/os/x86_64"}, CheckGPG: common.ToPtr(true)},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
test_distro.TestDistro2Name: {
|
test_distro.TestDistro2Name: {
|
||||||
test_distro.TestArchName: {
|
test_distro.TestArchName: {
|
||||||
{Name: "test-id-2", BaseURLs: []string{"http://example.com/test-2/os/x86_64"}, CheckGPG: true},
|
{Name: "test-id-2", BaseURLs: []string{"http://example.com/test-2/os/x86_64"}, CheckGPG: common.ToPtr(true)},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
@ -112,12 +112,12 @@ func createWeldrAPI2(tempdir string, fixtureGenerator rpmmd_mock.FixtureGenerato
|
||||||
rr := reporegistry.NewFromDistrosRepoConfigs(rpmmd.DistrosRepoConfigs{
|
rr := reporegistry.NewFromDistrosRepoConfigs(rpmmd.DistrosRepoConfigs{
|
||||||
test_distro.TestDistroName: {
|
test_distro.TestDistroName: {
|
||||||
test_distro.TestArch2Name: {
|
test_distro.TestArch2Name: {
|
||||||
{Name: "test-id", BaseURLs: []string{"http://example.com/test/os/x86_64"}, CheckGPG: true},
|
{Name: "test-id", BaseURLs: []string{"http://example.com/test/os/x86_64"}, CheckGPG: common.ToPtr(true)},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
test_distro.TestDistro2Name: {
|
test_distro.TestDistro2Name: {
|
||||||
test_distro.TestArch2Name: {
|
test_distro.TestArch2Name: {
|
||||||
{Name: "test-id-2", BaseURLs: []string{"http://example.com/test-2/os/x86_64"}, CheckGPG: true},
|
{Name: "test-id-2", BaseURLs: []string{"http://example.com/test-2/os/x86_64"}, CheckGPG: common.ToPtr(true)},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue