context: Ensure context name is valid on import

Signed-off-by: Chris Crone <christopher.crone@docker.com>
(cherry picked from commit 9ecc69d17e)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Chris Crone
2020-09-24 16:24:24 +02:00
committed by Sebastiaan van Stijn
parent a2f0cf527b
commit 8c2872d2a3
7 changed files with 40 additions and 25 deletions

View File

@ -68,7 +68,7 @@ func newUpdateCommand(dockerCli command.Cli) *cobra.Command {
// RunUpdate updates a Docker context
func RunUpdate(cli command.Cli, o *UpdateOptions) error {
if err := validateContextName(o.Name); err != nil {
if err := store.ValidateContextName(o.Name); err != nil {
return err
}
s := cli.ContextStore()