From 50cf97920a09ddb5b5e44834cc6e73b9727f1505 Mon Sep 17 00:00:00 2001 From: Justin Chadwell Date: Wed, 27 Jul 2022 12:06:47 +0100 Subject: [PATCH] buildx: error editing nodes with driver opts/config file Currently, editing nodes to contain a new set of driver options or config files is unsupported, so we want to explicitly mark it as so, instead of silently failing to set those options. In the future, we might support overriding these options, however, for now, we should give the user visability of the supported options. Signed-off-by: Justin Chadwell --- commands/create.go | 3 +++ store/nodegroup.go | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/commands/create.go b/commands/create.go index 39b8a4bc988f..78b6400996c0 100644 --- a/commands/create.go +++ b/commands/create.go @@ -300,6 +300,9 @@ func createCmd(dockerCli command.Cli) *cobra.Command { } func csvToMap(in []string) (map[string]string, error) { + if len(in) == 0 { + return nil, nil + } m := make(map[string]string, len(in)) for _, s := range in { csvReader := csv.NewReader(strings.NewReader(s)) diff --git a/store/nodegroup.go b/store/nodegroup.go index c9f97a672286..b80b4a7bd7eb 100644 --- a/store/nodegroup.go +++ b/store/nodegroup.go @@ -70,6 +70,12 @@ func (ng *NodeGroup) Update(name, endpoint string, platforms []string, endpoints if flags != nil { n.Flags = flags } + if do != nil { + return errors.Errorf("cannot update node with new driver options") + } + if configFile != "" { + return errors.Errorf("cannot update node with new config file") + } ng.Nodes[i] = n if err := ng.validateDuplicates(endpoint, i); err != nil { return err