Skip to content

Commit

Permalink
Merge pull request #23 from runatlantis/apply-bugfix
Browse files Browse the repository at this point in the history
Fix bug where apply -d was using parent dir.
  • Loading branch information
lkysow committed Mar 6, 2018
2 parents 4bd6128 + e6cdf15 commit 6ef567f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions server/events/apply_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ func (a *ApplyExecutor) Execute(ctx *CommandContext) CommandResponse {
} else {
// If they did specify a dir, we apply just the plan in that directory
// for this workspace.
path := filepath.Join(repoDir, ctx.Command.Dir, ctx.Command.Workspace+".tfplan")
stat, err := os.Stat(path)
planPath := filepath.Join(repoDir, ctx.Command.Dir, ctx.Command.Workspace+".tfplan")
stat, err := os.Stat(planPath)
if err != nil || stat.IsDir() {
return CommandResponse{Error: errors.Wrapf(err, "finding plan for dir %q and workspace %q", ctx.Command.Dir, ctx.Command.Workspace)}
return CommandResponse{Error: fmt.Errorf("no plan found at path %q and workspace %q–did you run plan?", ctx.Command.Dir, ctx.Command.Workspace)}
}
rel, _ := filepath.Rel(repoDir, filepath.Dir(path))
relProjectPath, _ := filepath.Rel(repoDir, filepath.Dir(planPath))
plans = append(plans, models.Plan{
Project: models.NewProject(ctx.BaseRepo.FullName, filepath.Dir(rel)),
LocalPath: path,
Project: models.NewProject(ctx.BaseRepo.FullName, relProjectPath),
LocalPath: planPath,
})
}
if len(plans) == 0 {
Expand Down

0 comments on commit 6ef567f

Please sign in to comment.