Skip to content

Commit

Permalink
fixed log statements
Browse files Browse the repository at this point in the history
  • Loading branch information
milldr committed Feb 7, 2025
1 parent 83f6e2c commit a9e74ff
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions internal/exec/terraform_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,16 @@ func cleanTerraformWorkspace(atmosConfig schema.AtmosConfiguration, componentPat

// Check if the file exists before attempting deletion
if _, err := os.Stat(filePath); err == nil {
l.LogDebug("Terraform environment file found. Proceeding with deletion.",
"file", filePath,
)
u.LogDebug(fmt.Sprintf("Terraform environment file found. Proceeding with deletion.\nFile: %s", filePath))
if err := os.Remove(filePath); err != nil {
l.LogDebug("Failed to delete Terraform environment file.",
"file", filePath,
"error", err,
)
u.LogDebug(fmt.Sprintf("Failed to delete Terraform environment file.\nFile: %s\nError: %s", filePath, err))
} else {
l.LogDebug("Successfully deleted Terraform environment file.",
"file", filePath,
)
u.LogDebug(fmt.Sprintf("Successfully deleted Terraform environment file.\nFile: %s", filePath))
}
} else if os.IsNotExist(err) {
l.LogDebug("Terraform environment file not found. No action needed.",
"file", filePath,
)
u.LogDebug(fmt.Sprintf("Terraform environment file not found. No action needed.\nFile: %s", filePath))
} else {
l.LogDebug("Error checking Terraform environment file.",
"file", filePath,
"error", err,
)
u.LogDebug(fmt.Sprintf("Error checking Terraform environment file.\nFile: %s\nError: %s", filePath, err))
}
}

Expand Down

0 comments on commit a9e74ff

Please sign in to comment.