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
|
|
@ -1363,7 +1363,7 @@ func genRepoConfig(repo Repository) (*rpmmd.RepoConfig, error) {
|
|||
}
|
||||
|
||||
if repo.CheckGpg != nil {
|
||||
repoConfig.CheckGPG = *repo.CheckGpg
|
||||
repoConfig.CheckGPG = repo.CheckGpg
|
||||
}
|
||||
if repo.Gpgkey != nil && *repo.Gpgkey != "" {
|
||||
repoConfig.GPGKeys = []string{*repo.Gpgkey}
|
||||
|
|
@ -1372,10 +1372,10 @@ func genRepoConfig(repo Repository) (*rpmmd.RepoConfig, error) {
|
|||
repoConfig.IgnoreSSL = *repo.IgnoreSsl
|
||||
}
|
||||
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)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue