]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Resolve symlinks in config paths by default
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 6 Aug 2023 17:51:37 +0000 (19:51 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 6 Aug 2023 17:51:37 +0000 (19:51 +0200)
mkosi/config.py

index f0ea7aa8c5cdd1c6c260ef49d938a9224751faff..a3e525d0d6467e890838732a3f18a205037c392b 100644 (file)
@@ -122,6 +122,7 @@ def parse_path(value: str,
                *,
                required: bool = True,
                absolute: bool = True,
+               resolve: bool = True,
                expanduser: bool = True,
                expandvars: bool = True,
                secret: bool = False) -> Path:
@@ -141,6 +142,9 @@ def parse_path(value: str,
     if absolute:
         path = path.absolute()
 
+    if resolve:
+        path = path.resolve()
+
     if secret and path.exists():
         mode = path.stat().st_mode & 0o777
         if mode & 0o007:
@@ -426,6 +430,7 @@ def make_path_parser(*,
 def config_make_path_parser(*,
                             required: bool = True,
                             absolute: bool = True,
+                            resolve: bool = True,
                             expanduser: bool = True,
                             expandvars: bool = True,
                             secret: bool = False) -> ConfigParseCallback:
@@ -438,6 +443,7 @@ def config_make_path_parser(*,
                 value,
                 required=required,
                 absolute=absolute,
+                resolve=resolve,
                 expanduser=expanduser,
                 expandvars=expandvars,
                 secret=secret,