Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2851 from hashicorp/cleanup/unused-code-path
Browse files Browse the repository at this point in the history
cli: cleanup unused code path
  • Loading branch information
krantzinator committed Dec 17, 2021
2 parents 2f209de + 8866ac3 commit f620510
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 25 deletions.
25 changes: 2 additions & 23 deletions internal/cli/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,29 +402,8 @@ func (c *baseCommand) Init(opts ...Option) error {
// the callback closure properties to cancel the passed in context. This
// will stop any remaining callbacks and exit early.
func (c *baseCommand) DoApp(ctx context.Context, f func(context.Context, *clientpkg.App) error) error {
var appTargets []string

// If the user specified a project flag, we want only the apps
// that are assigned to that project
if c.flagProject != "" {
client := c.project.Client()
projectTarget := &pb.Ref_Project{Project: c.flagProject}
resp, err := client.GetProject(c.Ctx, &pb.GetProjectRequest{
Project: &pb.Ref_Project{
Project: projectTarget.Project,
},
})
if err != nil {
c.ui.Output(clierrors.Humanize(err), terminal.WithErrorStyle())
return ErrSentinel
}
project := resp.Project

for _, a := range project.Applications {
appTargets = append(appTargets, a.Name)
}
}

// c.refApps is set in c.Init(), based on the project
// the command is running against
var apps []*clientpkg.App
for _, refApp := range c.refApps {
app := c.project.App(refApp.Application)
Expand Down
10 changes: 8 additions & 2 deletions test-e2e/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"os"
"os/exec"
"regexp"
"runtime"
"strings"
"testing"
"time"
Expand Down Expand Up @@ -65,8 +66,13 @@ func SetupTestProject(templateDir string) (projectName string, projectDir string
if err != nil {
return "", "", errors.Wrap(err, "failed to create temp dir")
}

cmd := exec.Command("cp", "-r", templateDir+"/", tempDir)
templateDir = templateDir + "/"
var cmd *exec.Cmd
if runtime.GOOS == "linux" {
cmd = exec.Command("rsync", "-av", templateDir, tempDir)
} else {
cmd = exec.Command("cp", "-r", templateDir, tempDir)
}
err = cmd.Run()
if err != nil {
return "", "", errors.Wrapf(err, "failed to copy %s to %s", templateDir, tempDir)
Expand Down

0 comments on commit f620510

Please sign in to comment.