osbuild: rename URLWithSecrets to CurlSourceOptions

New options were added to the object in osbuild.  CurlSourceOptions is a
more appropriate name since the object isn't only used for adding
secrets.
This commit is contained in:
Achilleas Koutsou 2022-06-15 12:04:06 +02:00 committed by Tomáš Hozza
parent fe918fd8a0
commit cd2c8e4c45
8 changed files with 11 additions and 11 deletions

View file

@ -743,7 +743,7 @@ func (t *imageType) sources(packages []rpmmd.PackageSpec, ostreeCommits []ostree
Items: make(map[string]osbuild.CurlSourceItem),
}
for _, pkg := range packages {
item := new(osbuild.URLWithSecrets)
item := new(osbuild.CurlSourceOptions)
item.URL = pkg.RemoteLocation
if pkg.Secrets == "org.osbuild.rhsm" {
item.Secrets = &osbuild.URLSecrets{

View file

@ -209,7 +209,7 @@ func (t *imageTypeS2) sources(packages []rpmmd.PackageSpec, ostreeCommits []ostr
Items: make(map[string]osbuild.CurlSourceItem),
}
for _, pkg := range packages {
item := new(osbuild.URLWithSecrets)
item := new(osbuild.CurlSourceOptions)
item.URL = pkg.RemoteLocation
if pkg.Secrets == "org.osbuild.rhsm" {
item.Secrets = &osbuild.URLSecrets{

View file

@ -415,7 +415,7 @@ func (t *imageType) sources(packages []rpmmd.PackageSpec, ostreeCommits []ostree
Items: make(map[string]osbuild.CurlSourceItem),
}
for _, pkg := range packages {
item := new(osbuild.URLWithSecrets)
item := new(osbuild.CurlSourceOptions)
item.URL = pkg.RemoteLocation
if pkg.Secrets == "org.osbuild.rhsm" {
item.Secrets = &osbuild.URLSecrets{

View file

@ -503,7 +503,7 @@ func (t *imageType) sources(packages []rpmmd.PackageSpec, ostreeCommits []ostree
Items: make(map[string]osbuild.CurlSourceItem),
}
for _, pkg := range packages {
item := new(osbuild.URLWithSecrets)
item := new(osbuild.CurlSourceOptions)
item.URL = pkg.RemoteLocation
if pkg.Secrets == "org.osbuild.rhsm" {
item.Secrets = &osbuild.URLSecrets{

View file

@ -503,7 +503,7 @@ func (t *imageType) sources(packages []rpmmd.PackageSpec, ostreeCommits []ostree
Items: make(map[string]osbuild.CurlSourceItem),
}
for _, pkg := range packages {
item := new(osbuild.URLWithSecrets)
item := new(osbuild.CurlSourceOptions)
item.URL = pkg.RemoteLocation
if pkg.Secrets == "org.osbuild.rhsm" {
item.Secrets = &osbuild.URLSecrets{

View file

@ -428,7 +428,7 @@ func (t *imageType) sources(packages []rpmmd.PackageSpec, ostreeCommits []ostree
Items: make(map[string]osbuild.CurlSourceItem),
}
for _, pkg := range packages {
item := new(osbuild.URLWithSecrets)
item := new(osbuild.CurlSourceOptions)
item.URL = pkg.RemoteLocation
if pkg.Secrets == "org.osbuild.rhsm" {
item.Secrets = &osbuild.URLSecrets{

View file

@ -21,12 +21,12 @@ type URL string
func (URL) isCurlSourceItem() {}
type URLWithSecrets struct {
type CurlSourceOptions struct {
URL string `json:"url"`
Secrets *URLSecrets `json:"secrets,omitempty"`
}
func (URLWithSecrets) isCurlSourceItem() {}
func (CurlSourceOptions) isCurlSourceItem() {}
type URLSecrets struct {
Name string `json:"name"`
@ -51,7 +51,7 @@ func (cs *CurlSource) UnmarshalJSON(data []byte) (err error) {
}
type csWithSecrets struct {
Items map[string]URLWithSecrets `json:"items"`
Items map[string]CurlSourceOptions `json:"items"`
}
withSecrets := new(csWithSecrets)
b.Reset(data)

View file

@ -65,8 +65,8 @@ func TestSource_UnmarshalJSON(t *testing.T) {
Type: "org.osbuild.curl",
Source: &CurlSource{
Items: map[string]CurlSourceItem{
"checksum1": URLWithSecrets{URL: "url1", Secrets: &URLSecrets{Name: "org.osbuild.rhsm"}},
"checksum2": URLWithSecrets{URL: "url2", Secrets: &URLSecrets{Name: "whatever"}},
"checksum1": CurlSourceOptions{URL: "url1", Secrets: &URLSecrets{Name: "org.osbuild.rhsm"}},
"checksum2": CurlSourceOptions{URL: "url2", Secrets: &URLSecrets{Name: "whatever"}},
}},
},
args: args{