weldr: use repo ids as source names

The naming is confusing: repositories have an `id` and a human readable
`name`. Weldr's sources also have a field called `name`, but
lorax-composer uses that as a way to identify repositories by their id.

Use `id` consistently here as well.
This commit is contained in:
Lars Karlitski 2019-11-17 09:50:25 +00:00 committed by Tom Gundersen
parent 740e4da733
commit 919d849123
2 changed files with 4 additions and 4 deletions

View file

@ -211,7 +211,7 @@ func (api *API) sourceInfoHandler(writer http.ResponseWriter, request *http.Requ
// check if the source is in the base repo
if name == api.repo.Id || name == "*" {
cfg := store.SourceConfig{
Name: api.repo.Name,
Name: api.repo.Id,
CheckGPG: true,
CheckSSL: true,
System: true,
@ -228,7 +228,7 @@ func (api *API) sourceInfoHandler(writer http.ResponseWriter, request *http.Requ
cfg.Type = "yum-mirrorlist"
}
sources[cfg.Name] = cfg
// check if the source is in the store
// check if the source is in the store
} else if source := api.store.GetSource(name); source != nil {
sources[source.Name] = *source
} else {

View file

@ -176,8 +176,8 @@ func TestBasic(t *testing.T) {
{"/api/v0/projects/source/info", http.StatusNotFound, ``},
{"/api/v0/projects/source/info/", http.StatusNotFound, `{"errors":[{"code":404,"id":"HTTPError","msg":"Not Found"}],"status":false}`},
{"/api/v0/projects/source/info/foo", http.StatusOK, `{"errors":[{"id":"UnknownSource","msg":"foo is not a valid source"}],"sources":{}}`},
{"/api/v0/projects/source/info/test", http.StatusOK, `{"sources":{"Test":{"name":"Test","type":"yum-baseurl","url":"http://example.com/test/os","check_gpg":true,"check_ssl":true,"system":true}},"errors":[]}`},
{"/api/v0/projects/source/info/*", http.StatusOK, `{"sources":{"Test":{"name":"Test","type":"yum-baseurl","url":"http://example.com/test/os","check_gpg":true,"check_ssl":true,"system":true}},"errors":[]}`},
{"/api/v0/projects/source/info/test", http.StatusOK, `{"sources":{"test":{"name":"test","type":"yum-baseurl","url":"http://example.com/test/os","check_gpg":true,"check_ssl":true,"system":true}},"errors":[]}`},
{"/api/v0/projects/source/info/*", http.StatusOK, `{"sources":{"test":{"name":"test","type":"yum-baseurl","url":"http://example.com/test/os","check_gpg":true,"check_ssl":true,"system":true}},"errors":[]}`},
{"/api/v0/blueprints/list", http.StatusOK, `{"total":0,"offset":0,"limit":0,"blueprints":[]}`},
{"/api/v0/blueprints/info/", http.StatusNotFound, `{"errors":[{"code":404,"id":"HTTPError","msg":"Not Found"}],"status":false}`},