Skip to content

Commit

Permalink
resolve compute for group for "console" (#4035)
Browse files Browse the repository at this point in the history
replace logic that only looks for a specific console override with one
that uses the standard function for finding the most specific vm
compute requirements for group console.

https://github.com/superfly/flyctl/blob/7467ca0c3e46d0b5e28e367dc290eb52f57b0fc4/internal/appconfig/processgroups.go#L188-L193
  • Loading branch information
rubys authored Oct 26, 2024
1 parent 7467ca0 commit b9b83dd
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions internal/command/console/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"maps"
"slices"

"github.com/google/shlex"
"github.com/samber/lo"
Expand Down Expand Up @@ -401,18 +400,8 @@ func makeEphemeralConsoleMachine(ctx context.Context, app *fly.AppCompact, appCo
func determineEphemeralConsoleMachineGuest(ctx context.Context, appConfig *appconfig.Config) (*fly.MachineGuest, error) {
var guest *fly.MachineGuest

haveConsoleVMSection := 0 <= slices.IndexFunc(
appConfig.Compute,
func(c *appconfig.Compute) bool {
return slices.Index(c.Processes, "console") >= 0
},
)
if haveConsoleVMSection {
groupConfig, err := appConfig.ToMachineConfig("console", nil)
if err != nil {
return nil, fmt.Errorf("failed to check Machine configuration for the 'console' group: %w", err)
}
guest = groupConfig.Guest
if compute := appConfig.ComputeForGroup("console"); compute != nil {
guest = compute.MachineGuest
}

guest, err := flag.GetMachineGuest(ctx, guest)
Expand Down

0 comments on commit b9b83dd

Please sign in to comment.