Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/cmd/cli/command/globals.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ in the file conflict with existing shell environment variables. If conflicts are
found, it warns the user that the shell environment variable will take precedence.
*/
func checkEnvConflicts(stackName string) error {

path, err := filepath.Abs(filepath.Join(stacks.Directory, stackName))
if err != nil {
return err
Expand Down
1 change: 0 additions & 1 deletion src/cmd/cli/command/globals_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,6 @@ AWS_REGION="us-east-1"`,

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {

prevTerm := term.DefaultTerm
var stdout, stderr bytes.Buffer
term.DefaultTerm = term.NewTerm(os.Stdin, &stdout, &stderr)
Expand Down
2 changes: 1 addition & 1 deletion src/pkg/agent/tools/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func HandleServicesTool(ctx context.Context, loader cliClient.ProjectLoader, cli
if err != nil {
var noServicesErr defangcli.ErrNoServices
if errors.As(err, &noServicesErr) {
return fmt.Sprintf("no services found for the specified project %q", projectName), nil
return err.Error(), nil
}
if connect.CodeOf(err) == connect.CodeNotFound && strings.Contains(err.Error(), "is not deployed in Playground") {
return fmt.Sprintf("project %s is not deployed in Playground", projectName), nil
Expand Down
2 changes: 1 addition & 1 deletion src/pkg/agent/tools/services_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func TestHandleServicesToolWithMockCLI(t *testing.T) {
GetServicesError: defangcli.ErrNoServices{ProjectName: "test-project"},
},
expectedError: false, // Returns successful result with message
resultTextContains: "no services found for the specified project",
resultTextContains: "no services found in project",
expectedGetServices: true,
expectedProjectName: "test-project",
},
Expand Down
3 changes: 2 additions & 1 deletion src/pkg/cli/getServices.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cli

import (
"context"
"fmt"
"net/http"
"strings"
"sync"
Expand All @@ -20,7 +21,7 @@ func (e ErrNoServices) Error() string {
if e.ProjectName == "" {
return "no services found"
}
return "no services found in project " + e.ProjectName
return fmt.Sprintf("no services found in project %q; check logs for deployment status", e.ProjectName)
}

func GetServices(ctx context.Context, projectName string, provider client.Provider, long bool) error {
Expand Down
12 changes: 2 additions & 10 deletions src/pkg/mcp/deployment_info/deployment_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,13 @@ package deployment_info

import (
"context"
"fmt"

"github.com/DefangLabs/defang/src/pkg/cli"
"github.com/DefangLabs/defang/src/pkg/cli/client"
"github.com/DefangLabs/defang/src/pkg/term"
defangv1 "github.com/DefangLabs/defang/src/protos/io/defang/v1"
)

type ErrNoServices struct {
ProjectName string // may be empty
}

func (e ErrNoServices) Error() string {
return fmt.Sprintf("no services found in project %q", e.ProjectName)
}

type Service struct {
Service string
DeploymentId string
Expand All @@ -37,7 +29,7 @@ func GetServices(ctx context.Context, projectName string, provider client.Provid
numServices := len(getServicesResponse.Services)

if numServices == 0 {
return nil, ErrNoServices{ProjectName: projectName}
return nil, cli.ErrNoServices{ProjectName: projectName}
}

result := make([]Service, numServices)
Expand Down
4 changes: 2 additions & 2 deletions src/pkg/migrate/heroku.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,10 +334,10 @@ func authenticateHerokuCLI() error {
}

// getHerokuAuthTokenFromCLI obtains a short-lived Heroku API token by invoking the local Heroku CLI.
//
//
// It checks that the `heroku` executable is available, ensures the CLI is authenticated, runs
// `heroku authorizations:create --expires-in=300 --json`, and parses the resulting JSON for the token.
//
//
// The returned string is the extracted access token. An error is returned if the CLI is not installed,
// authentication fails, the command cannot be executed, or the command output cannot be parsed.
func getHerokuAuthTokenFromCLI() (string, error) {
Expand Down
Loading