distro: don't use a global variable to store the distro register

Introduce a DistroRegister object. For now this does not introduce
any functional changes, as the object is always instantited to be
the same. However, in follow-up patches it will get options.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2019-12-19 13:47:07 +01:00
parent 6c49560479
commit 5fcdd4bea5
11 changed files with 59 additions and 40 deletions

View file

@ -30,7 +30,8 @@ type JobStatus struct {
}
func (job *Job) Run() (*store.Image, error, []error) {
d := distro.New(job.Distro)
distros := distro.NewRegistry()
d := distros.GetDistro(job.Distro)
if d == nil {
return nil, fmt.Errorf("unknown distro: %s", job.Distro), nil
}