From cd2c8e4c453220c7b6d3fd54581c0bbb0c37f568 Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Wed, 15 Jun 2022 12:04:06 +0200 Subject: [PATCH] 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. --- internal/distro/fedora/distro.go | 2 +- internal/distro/rhel84/distro_v2.go | 2 +- internal/distro/rhel85/distro.go | 2 +- internal/distro/rhel86/distro.go | 2 +- internal/distro/rhel90/distro.go | 2 +- internal/distro/rhel90beta/distro.go | 2 +- internal/osbuild2/curl_source.go | 6 +++--- internal/osbuild2/source_test.go | 4 ++-- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/internal/distro/fedora/distro.go b/internal/distro/fedora/distro.go index 5a50a72f0..671d160eb 100644 --- a/internal/distro/fedora/distro.go +++ b/internal/distro/fedora/distro.go @@ -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{ diff --git a/internal/distro/rhel84/distro_v2.go b/internal/distro/rhel84/distro_v2.go index 81ce1d1d9..4fdda86fa 100644 --- a/internal/distro/rhel84/distro_v2.go +++ b/internal/distro/rhel84/distro_v2.go @@ -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{ diff --git a/internal/distro/rhel85/distro.go b/internal/distro/rhel85/distro.go index b5ca034c2..d8565a228 100644 --- a/internal/distro/rhel85/distro.go +++ b/internal/distro/rhel85/distro.go @@ -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{ diff --git a/internal/distro/rhel86/distro.go b/internal/distro/rhel86/distro.go index 5bffebc0f..5d1acea0d 100644 --- a/internal/distro/rhel86/distro.go +++ b/internal/distro/rhel86/distro.go @@ -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{ diff --git a/internal/distro/rhel90/distro.go b/internal/distro/rhel90/distro.go index 8248ff3fb..271c9a621 100644 --- a/internal/distro/rhel90/distro.go +++ b/internal/distro/rhel90/distro.go @@ -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{ diff --git a/internal/distro/rhel90beta/distro.go b/internal/distro/rhel90beta/distro.go index 4d9e4d5b8..66fd12b8d 100644 --- a/internal/distro/rhel90beta/distro.go +++ b/internal/distro/rhel90beta/distro.go @@ -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{ diff --git a/internal/osbuild2/curl_source.go b/internal/osbuild2/curl_source.go index 1c9ad35c9..2d21943e7 100644 --- a/internal/osbuild2/curl_source.go +++ b/internal/osbuild2/curl_source.go @@ -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) diff --git a/internal/osbuild2/source_test.go b/internal/osbuild2/source_test.go index 525fe4e4f..c86127d0a 100644 --- a/internal/osbuild2/source_test.go +++ b/internal/osbuild2/source_test.go @@ -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{