Skip to content

Commit

Permalink
Fix instance creation
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre-Emmanuel Jacquier <[email protected]>
  • Loading branch information
pierre-emmanuelJ committed Jul 24, 2024
1 parent eeccc70 commit e096d1b
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions cmd/instance_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (c *instanceCreateCmd) cmdRun(_ *cobra.Command, _ []string) error { //nolin
}

if l := len(c.AntiAffinityGroups); l > 0 {
antiAffinityGroupIDs := make([]v3.AntiAffinityGroup, l)
instanceReq.AntiAffinityGroups = make([]v3.AntiAffinityGroup, l)
af, err := client.ListAntiAffinityGroups(ctx)
if err != nil {
return fmt.Errorf("error listing Anti-Affinity Group: %w", err)
Expand All @@ -109,10 +109,8 @@ func (c *instanceCreateCmd) cmdRun(_ *cobra.Command, _ []string) error { //nolin
if err != nil {
return fmt.Errorf("error retrieving Anti-Affinity Group: %w", err)
}
antiAffinityGroupIDs[i] = antiAffinityGroup
instanceReq.AntiAffinityGroups[i] = v3.AntiAffinityGroup{ID: antiAffinityGroup.ID}
}

instanceReq.AntiAffinityGroups = antiAffinityGroupIDs
}

if c.DeployTarget != "" {
Expand Down Expand Up @@ -171,7 +169,7 @@ func (c *instanceCreateCmd) cmdRun(_ *cobra.Command, _ []string) error { //nolin
if err != nil {
return fmt.Errorf("error retrieving Security Group: %w", err)
}
instanceReq.SecurityGroups[i] = securityGroup
instanceReq.SecurityGroups[i] = v3.SecurityGroup{ID: securityGroup.ID}
}
}

Expand Down

0 comments on commit e096d1b

Please sign in to comment.