Skip to content

Commit

Permalink
delete files in .terraform rather than sending them to trash (#2547)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbordash2 authored Sep 6, 2024
1 parent 6bff212 commit b08af9e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 20 deletions.
18 changes: 1 addition & 17 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ pyhcl = "^0.4" # does not support HCL2, possibly move to extras_require in the
python-hcl2 = ">=3.0.0"
pyyaml = ">5.4"
requests = "*"
send2trash = "*"
tomli = ">=1.2.2"
troposphere = ">=2.4, <5"
typing_extensions = "*" # only really needed for < 3.8 but can still be used in >= 3.8
Expand Down
7 changes: 5 additions & 2 deletions runway/module/terraform.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
import json
import logging
import re
import shutil
import subprocess
import sys
from pathlib import Path
from typing import TYPE_CHECKING, Any, cast

import hcl
from send2trash import send2trash
from typing_extensions import Literal

from .._logging import PrefixAdaptor
Expand Down Expand Up @@ -414,7 +414,10 @@ def cleanup_dot_terraform(self) -> None:
self.logger.debug("directory retained: %s", child)
continue
self.logger.debug("removing: %s", child)
send2trash(str(child)) # does not support Path objects
if child.is_dir():
shutil.rmtree(child, ignore_errors=True)
else:
child.unlink(missing_ok=True)

def deploy(self) -> None:
"""Run Terraform apply."""
Expand Down

0 comments on commit b08af9e

Please sign in to comment.