Skip to content

Commit

Permalink
move name and region checks closer to "meta" assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
weave-e2e-quickstart committed Feb 20, 2019
1 parent 65008ab commit 7e5a3a1
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions pkg/ctl/create/nodegroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,16 @@ func doCreateNodeGroups(p *api.ProviderConfig, cfg *api.ClusterConfig, nameArg s
}
meta = cfg.Metadata

if meta.Name == "" {
return fmt.Errorf("metadata.name must be set")
}

if meta.Region == "" {
return fmt.Errorf("metadata.region must be set")
}

p.Region = meta.Region

// Limit nodegroups to set specified on command line via globs
if err := filterNodeGroups(cfg); err != nil {
return err
Expand Down Expand Up @@ -149,16 +159,6 @@ func doCreateNodeGroups(p *api.ProviderConfig, cfg *api.ClusterConfig, nameArg s
}
}

if meta.Name == "" {
return fmt.Errorf("metadata.name must be set")
}

if meta.Region == "" {
return fmt.Errorf("metadata.region must be set")
}

p.Region = meta.Region

if err := checkEachNodeGroup(cfg, newNodeGroupChecker); err != nil {
return err
}
Expand Down

0 comments on commit 7e5a3a1

Please sign in to comment.