Add option to disable like distros in decoder
This commit is contained in:
parent
bdca0a5ffc
commit
74adb915fc
|
@ -49,12 +49,15 @@ func (nfe VarNotFoundError) Error() string {
|
||||||
type Decoder struct {
|
type Decoder struct {
|
||||||
info *distro.OSRelease
|
info *distro.OSRelease
|
||||||
runner *interp.Runner
|
runner *interp.Runner
|
||||||
|
// Enable distro overrides (true by default)
|
||||||
Overrides bool
|
Overrides bool
|
||||||
|
// Enable using like distros for overrides (true by default)
|
||||||
|
LikeDistros bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// New creates a new variable decoder
|
// New creates a new variable decoder
|
||||||
func New(info *distro.OSRelease, runner *interp.Runner) *Decoder {
|
func New(info *distro.OSRelease, runner *interp.Runner) *Decoder {
|
||||||
return &Decoder{info, runner, true}
|
return &Decoder{info, runner, true, true}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DecodeVar decodes a variable to val using reflection.
|
// DecodeVar decodes a variable to val using reflection.
|
||||||
|
@ -206,7 +209,9 @@ func (d *Decoder) genPossibleNames(name string) []string {
|
||||||
}
|
}
|
||||||
|
|
||||||
distros := []string{d.info.ID}
|
distros := []string{d.info.ID}
|
||||||
|
if d.LikeDistros {
|
||||||
distros = append(distros, d.info.Like...)
|
distros = append(distros, d.info.Like...)
|
||||||
|
}
|
||||||
|
|
||||||
var out []string
|
var out []string
|
||||||
for _, arch := range architectures {
|
for _, arch := range architectures {
|
||||||
|
|
Loading…
Reference in New Issue