Skip to content

Commit

Permalink
create directory for applied plans before listing the directory (#77)
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Kim <[email protected]>
  • Loading branch information
Oats87 committed Mar 4, 2022
1 parent ad6e3be commit 414141a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/applyinator/applyinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ func (a *Applyinator) Apply(ctx context.Context, input ApplyInput) (ApplyOutput,
logrus.Tracef("[Applyinator] Using %s as execution directory", executionDir)
if a.appliedPlanDir != "" {
logrus.Debugf("[Applyinator] Writing applied calculated plan contents to historical plan directory %s", a.appliedPlanDir)
if err := os.MkdirAll(a.appliedPlanDir, 0700); err != nil {
logrus.Errorf("error creawting applied plan directory: %v", err)
}
if err := a.writePlanToDisk(now, &input.CalculatedPlan); err != nil {
logrus.Errorf("error writing applied plan to disk: %v", err)
}
Expand Down Expand Up @@ -378,9 +381,6 @@ func (a *Applyinator) writePlanToDisk(now time.Time, plan *CalculatedPlan) error
}

file := now.Format(applyinatorDateCodeLayout) + appliedPlanFileSuffix
if err := os.MkdirAll(a.appliedPlanDir, 0700); err != nil {
return err
}
anpString, err := json.Marshal(plan)
if err != nil {
return err
Expand Down

0 comments on commit 414141a

Please sign in to comment.