machine: relax config validation

Don't raise an exception if the option in a path does not exist.  Remove
the option and fall back to the default path location

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2022-10-15 19:58:34 -04:00
parent 3ad7d0668a
commit 05ca71f5a8
No known key found for this signature in database
GPG Key ID: 5A1EB336DFB4C71B
1 changed files with 12 additions and 1 deletions

View File

@ -1427,12 +1427,17 @@ class InstallValidator:
) -> None: ) -> None:
if isinstance(source_dir, str): if isinstance(source_dir, str):
source_dir = pathlib.Path(source_dir).expanduser().resolve() source_dir = pathlib.Path(source_dir).expanduser().resolve()
subfolder = self.data_path.joinpath(folder_name)
if not source_dir.exists():
logging.info(
f"Source path '{source_dir}' does not exist. Falling "
f"back to default folder {subfolder}"
)
if not source_dir.is_dir(): if not source_dir.is_dir():
raise ValidationError( raise ValidationError(
f"Failed to link subfolder '{folder_name}' to source path " f"Failed to link subfolder '{folder_name}' to source path "
f"'{source_dir}'. The requested path is not a valid directory." f"'{source_dir}'. The requested path is not a valid directory."
) )
subfolder = self.data_path.joinpath(folder_name)
if subfolder.is_symlink(): if subfolder.is_symlink():
if not subfolder.samefile(source_dir): if not subfolder.samefile(source_dir):
raise ValidationError( raise ValidationError(
@ -1465,6 +1470,12 @@ class InstallValidator:
if isinstance(target, str): if isinstance(target, str):
target = pathlib.Path(target) target = pathlib.Path(target)
target = target.expanduser().resolve() target = target.expanduser().resolve()
if not target.exists():
logging.info(
f"Target file {target} does not exist. Aborting symbolic "
f"link to {data_file.name}."
)
return
if not target.is_file(): if not target.is_file():
raise ValidationError( raise ValidationError(
f"Failed to link data file {data_file.name}. Target " f"Failed to link data file {data_file.name}. Target "