]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
run: Use is_symlink() instead of exists()
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 9 Feb 2023 21:51:23 +0000 (22:51 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 9 Feb 2023 22:13:57 +0000 (23:13 +0100)
exists() will resolve the symlink in the host if it's absolute,
let's use is_symlink() which checks if the symlink exists.

mkosi/run.py

index 2008443362a34bab27a4756c3b06e6d3df810898..61475c500d784370110174c5275e402856fd7c71 100644 (file)
@@ -332,5 +332,5 @@ def run_workspace_command(
             run([*cmdline, template.format("sh")], check=False, env=env)
         die(f"\"{shlex.join(str(s) for s in cmd)}\" returned non-zero exit code {e.returncode}.")
     finally:
-        if state.workspace.joinpath("resolv.conf").exists():
+        if state.workspace.joinpath("resolv.conf").is_symlink():
             shutil.move(state.workspace.joinpath("resolv.conf"), resolve)