distroregistry: Add host's architecture name to the registry
The store needs to know what default distribution and arch to use for images built with a blueprint that has no distro set. Store the host's architecture name along side the host's distribution details. SetHostArchName() allows this host arch to be overridden for testing, which uses arch names that do not match any host.
This commit is contained in:
parent
626530818d
commit
bcb927cf63
1 changed files with 16 additions and 4 deletions
|
|
@ -40,14 +40,16 @@ type supportedDistro struct {
|
|||
}
|
||||
|
||||
type Registry struct {
|
||||
distros map[string]distro.Distro
|
||||
hostDistro distro.Distro
|
||||
distros map[string]distro.Distro
|
||||
hostDistro distro.Distro
|
||||
hostArchName string
|
||||
}
|
||||
|
||||
func New(hostDistro distro.Distro, distros ...distro.Distro) (*Registry, error) {
|
||||
reg := &Registry{
|
||||
distros: make(map[string]distro.Distro),
|
||||
hostDistro: hostDistro,
|
||||
distros: make(map[string]distro.Distro),
|
||||
hostDistro: hostDistro,
|
||||
hostArchName: common.CurrentArch(),
|
||||
}
|
||||
for _, d := range distros {
|
||||
name := d.Name()
|
||||
|
|
@ -136,3 +138,13 @@ func mangleHostDistroName(name string, isBeta, isStream bool) string {
|
|||
func (r *Registry) FromHost() distro.Distro {
|
||||
return r.hostDistro
|
||||
}
|
||||
|
||||
// HostArchName returns the host's arch name
|
||||
func (r *Registry) HostArchName() string {
|
||||
return r.hostArchName
|
||||
}
|
||||
|
||||
// SetHostArchName can be used to override the host's arch name for testing
|
||||
func (r *Registry) SetHostArchName(name string) {
|
||||
r.hostArchName = name
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue