Skip to content

Commit 93253d4

Browse files
authored
Merge pull request #149 from desultory/dev
Remove processing for old config style, improve logging
2 parents d772df3 + 2e7a6d1 commit 93253d4

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

src/ugrd/fs/mounts.py

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__author__ = "desultory"
2-
__version__ = "5.7.2"
2+
__version__ = "5.8.0"
33

44
from pathlib import Path
55
from typing import Union
@@ -37,20 +37,7 @@ def _validate_mount_config(self, mount_name: str, mount_config) -> None:
3737

3838
for parameter, value in mount_config.copy().items():
3939
self.logger.debug("[%s] Validating parameter: %s" % (mount_name, parameter))
40-
if parameter == "source" and isinstance(value, dict):
41-
self.logger.warning("source dict is deprecated, please define the source type directly.")
42-
self.logger.info(
43-
"Simply define the source type directly in the mount config, instead of using the 'source' dict."
44-
)
45-
# Break if the source type is valid
46-
for source_type in SOURCE_TYPES:
47-
if source_type in value:
48-
mount_config[source_type] = value[source_type]
49-
break
50-
else:
51-
self.logger.error("Valid source types: %s" % SOURCE_TYPES)
52-
raise ValueError("Invalid source type in mount: %s" % value)
53-
elif parameter == "options" and not mount_config.get("no_validate_options"):
40+
if parameter == "options" and not mount_config.get("no_validate_options"):
5441
for option in value:
5542
if "subvol=" in option:
5643
if mount_name == "root":
@@ -601,7 +588,8 @@ def _autodetect_mount(self, mountpoint) -> None:
601588
mount_name = "root" if mountpoint == "/" else mountpoint.removeprefix("/")
602589
if mount_name in self["mounts"] and any(s_type in self["mounts"][mount_name] for s_type in SOURCE_TYPES):
603590
return self.logger.warning(
604-
"[%s] Mount config already set: %s" % (mountpoint, pretty_print(self["mounts"][mount_name]))
591+
"[%s] Skipping autodetection, mount config already set:\n%s"
592+
% (colorize(mountpoint, "yellow"), pretty_print(self["mounts"][mount_name]))
605593
)
606594

607595
mount_config = {mount_name: {"type": "auto", "options": ["ro"]}} # Default to auto and ro

0 commit comments

Comments
 (0)