Skip to content

Commit

Permalink
Fix tail without project
Browse files Browse the repository at this point in the history
  • Loading branch information
lionello committed Jan 10, 2025
1 parent acde940 commit 4f21c1d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions src/cmd/cli/command/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -1139,16 +1139,16 @@ func canIUseProvider(ctx context.Context, provider cliClient.Provider, projectNa
}

func determineProviderID(ctx context.Context, loader cliClient.Loader) (string, error) {
var projName string
var projectName string
if loader != nil {
var err error
projName, err = loader.LoadProjectName(ctx)
projectName, err = loader.LoadProjectName(ctx)
if err != nil {
term.Warn("Unable to load project:", err)
}

if projName != "" && !RootCmd.PersistentFlags().Changed("provider") { // If user manually selected auto provider, do not load from remote
resp, err := client.GetSelectedProvider(ctx, &defangv1.GetSelectedProviderRequest{Project: projName})
if projectName != "" && !RootCmd.PersistentFlags().Changed("provider") { // If user manually selected auto provider, do not load from remote
resp, err := client.GetSelectedProvider(ctx, &defangv1.GetSelectedProviderRequest{Project: projectName})
if err != nil {
term.Warn("Unable to get selected provider:", err)
} else if resp.Provider != defangv1.Provider_PROVIDER_UNSPECIFIED {
Expand Down Expand Up @@ -1190,11 +1190,11 @@ func determineProviderID(ctx context.Context, loader cliClient.Loader) (string,
}

// Save the selected provider to the fabric
if projName != "" {
if err := client.SetSelectedProvider(ctx, &defangv1.SetSelectedProviderRequest{Project: projName, Provider: providerID.EnumValue()}); err != nil {
if projectName != "" {
if err := client.SetSelectedProvider(ctx, &defangv1.SetSelectedProviderRequest{Project: projectName, Provider: providerID.EnumValue()}); err != nil {
term.Warn("Unable to save selected provider to defang server:", err)
} else {
term.Printf("%v is now the default provider for project %v and will auto-select next time if no other provider is specified. Use --provider=auto to reselect.", providerID, projName)
term.Printf("%v is now the default provider for project %v and will auto-select next time if no other provider is specified. Use --provider=auto to reselect.", providerID, projectName)
}
}
return "interactive prompt", nil
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/cli/command/compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,12 +475,12 @@ func makeComposeLogsCmd() *cobra.Command {
term.Debug("logType", logType)

loader := configureLoader(cmd)
projectName, err := loader.LoadProjectName(cmd.Context())
provider, err := getProvider(cmd.Context(), loader)
if err != nil {
return err
}

provider, err := getProvider(cmd.Context(), loader)
projectName, err := cliClient.LoadProjectNameWithFallback(cmd.Context(), loader, provider)
if err != nil {
return err
}
Expand Down

0 comments on commit 4f21c1d

Please sign in to comment.