Closed KincaidYang closed 1 month ago
Can be fixed by deleting the build dir before copying to it. I will open a PR @thatmattlove
diff --git a/hyperglass/frontend/__init__.py b/hyperglass/frontend/__init__.py
index 2fe338e..cd0ce5b 100644
--- a/hyperglass/frontend/__init__.py
+++ b/hyperglass/frontend/__init__.py
@@ -131,6 +131,7 @@ async def build_ui(app_path: Path):
log.error(err)
raise RuntimeError(str(err)) from err
+ shutil.rmtree(build_dir)
shutil.copytree(out_dir, build_dir)
log.bind(src=out_dir, dst=build_dir).debug("Migrated Next.JS build output")
Hey @maluueu - Apologies for not merging #246 directly; I was working on a number of other changes and forgot to merge your change beforehand. I did modify your change slightly by using the dirs_exist_ok=True
argument to shutil.copytree
, but the result is the same. This should be fixed now.
Hey @maluueu - Apologies for not merging #246 directly; I was working on a number of other changes and forgot to merge your change beforehand. I did modify your change slightly by using the
dirs_exist_ok=True
argument toshutil.copytree
, but the result is the same. This should be fixed now.
Hey @thatmattlove, no worries. Regarding the issue, are you sure that dirs_exist_ok=True
fixes it completely?
Consider the following scenario:
Wouldn't this cause File A to still exist in the output dir, rather than being removed fully?
Ya know, you're right. If you don't mind, open another PR against the current commit and I'll merge it. Thank you!
Ya know, you're right. If you don't mind, open another PR against the current commit and I'll merge it. Thank you!
sure, will do!
@thatmattlove done (#247), also set exist_dir to False as that should never happen
Hi @thatmattlove , I encountered some issues. When running for the first time with
docker compose up
, everything was normal. However, when I stopped it and started again withsystemctl start hyperglass
, I ran into this problem. The output fromsystemctl status hyperglass
showed that it was running normally, but in reality, it was unusable. Later, after stopping the service, I tried running it again withdocker compose up
and encountered the following error. I believe that when a file already exists, it should be overwritten or skipped instead of throwing an exception.