From 13b74e0d80dfb7a01f4cde62538bad0c136a7faf Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Mon, 6 May 2019 16:55:23 -0700 Subject: [PATCH] platformutil: add local platform Signed-off-by: Tonis Tiigi --- util/platformutil/parse.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/util/platformutil/parse.go b/util/platformutil/parse.go index de0d5bdc..d1bc9a50 100644 --- a/util/platformutil/parse.go +++ b/util/platformutil/parse.go @@ -22,7 +22,7 @@ func Parse(platformsStr []string) ([]specs.Platform, error) { out = append(out, p...) continue } - p, err := platforms.Parse(s) + p, err := parse(s) if err != nil { return nil, err } @@ -31,6 +31,13 @@ func Parse(platformsStr []string) ([]specs.Platform, error) { return out, nil } +func parse(in string) (specs.Platform, error) { + if strings.EqualFold(in, "local") { + return platforms.DefaultSpec(), nil + } + return platforms.Parse(in) +} + func Dedupe(in []specs.Platform) []specs.Platform { m := map[string]struct{}{} out := make([]specs.Platform, 0, len(in))