machines delete: fix - delete all existing files
All checks were successful
checks-impure / test (pull_request) Successful in 14s
checks / test (pull_request) Successful in 1m8s

This commit is contained in:
DavHau 2023-09-02 18:37:40 +02:00
parent 2a11b1c5d1
commit a56073b051

View File

@ -1,4 +1,5 @@
import argparse
import shutil
from ..errors import ClanError
from .folders import machine_folder
@ -7,7 +8,7 @@ from .folders import machine_folder
def delete_command(args: argparse.Namespace) -> None:
folder = machine_folder(args.host)
if folder.exists():
folder.rmdir()
shutil.rmtree(folder)
else:
raise ClanError(f"Machine {args.host} does not exist")