Skip to content

Commit

Permalink
Fix name argument for scale nodegroup
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbeaumont committed Jul 10, 2020
1 parent 59776f8 commit 2e8b66c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
7 changes: 2 additions & 5 deletions pkg/ctl/cmdutils/configfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ type commonClusterConfigLoader struct {
flagsIncompatibleWithoutConfigFile sets.String
validateWithConfigFile func() error
validateWithoutConfigFile func() error
nameArgumentAllowed bool
}

var (
Expand Down Expand Up @@ -99,10 +98,8 @@ func (l *commonClusterConfigLoader) Load() error {
}
}

if !l.nameArgumentAllowed {
if l.NameArg != "" {
return ErrCannotUseWithConfigFile(fmt.Sprintf("name argument %q", l.NameArg))
}
if l.flagsIncompatibleWithConfigFile.Has("name") && l.NameArg != "" {
return ErrCannotUseWithConfigFile("name argument")
}

if meta.Name == "" {
Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/cmdutils/configfile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ var _ = Describe("cmdutils configfile", func() {

err := NewMetadataLoader(cmd).Load()
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(Equal(ErrCannotUseWithConfigFile(`name argument "foo-3"`).Error()))
Expect(err.Error()).To(Equal(ErrCannotUseWithConfigFile(`name argument`).Error()))

fs := cmd.CobraCommand.Flags()

Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/cmdutils/scale.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import (
// NewScaleNodeGroupLoader will load config or use flags for 'eksctl scale nodegroup'
func NewScaleNodeGroupLoader(cmd *Cmd, ng *api.NodeGroup) ClusterConfigLoader {
l := newCommonClusterConfigLoader(cmd)
l.nameArgumentAllowed = true

l.flagsIncompatibleWithConfigFile.Insert(
"nodes",
"nodes-min",
"nodes-max",
)
l.flagsIncompatibleWithConfigFile.Delete("name")

l.validateWithConfigFile = func() error {
if err := validateNameArgument(cmd, ng); err != nil {
Expand Down

0 comments on commit 2e8b66c

Please sign in to comment.