mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-02 12:56:24 -05:00
Configs without database rows read and validate only; imports run off the event loop (#874)
The base import for a config with no sections now reads its file once, reports a 0-byte file as empty, treats a missing file as the defaults, and records success or failure itself (sending the failure Event on request). The per-config overrides that only set successful_import are removed. wrolpi.yaml and the downloader settings import in a thread at startup (import_file_configs), and the Import, Save and backup Import buttons run their config work in a thread. The pre-diff import path (import_decision, record_import_version) has no callers left and is removed. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
ee10b34b15
commit
c3e25b84d6
12 changed files with 251 additions and 145 deletions
|
|
@ -418,10 +418,6 @@ class ArchiveDownloaderConfig(ConfigFile):
|
|||
"""Get the custom user agent, or None for system default."""
|
||||
return self._config.get('user_agent')
|
||||
|
||||
def import_config(self, file: pathlib.Path = None, send_events=False):
|
||||
super().import_config(file, send_events)
|
||||
self.successful_import = True
|
||||
|
||||
|
||||
# Global instance for archive downloader config
|
||||
ARCHIVE_DOWNLOADER_CONFIG: ArchiveDownloaderConfig = ArchiveDownloaderConfig()
|
||||
|
|
|
|||
|
|
@ -26,11 +26,6 @@ class FlasherConfig(ConfigFile):
|
|||
)
|
||||
validator = FlasherConfigValidator
|
||||
|
||||
def import_config(self, file=None, send_events=False):
|
||||
super().import_config(file, send_events)
|
||||
# YAML-only config (no database); a successful read is a successful import.
|
||||
self.successful_import = True
|
||||
|
||||
@property
|
||||
def configurations(self) -> List[dict]:
|
||||
return list(self._config.get('configurations', []))
|
||||
|
|
|
|||
|
|
@ -105,7 +105,6 @@ def import_catalog_config():
|
|||
config = get_catalog_config()
|
||||
if config.get_file().is_file():
|
||||
config.import_config()
|
||||
config.successful_import = True
|
||||
seed_catalog_defaults(config)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -22,10 +22,6 @@ class MapPinsConfig(ConfigFile):
|
|||
)
|
||||
validator = MapPinsConfigValidator
|
||||
|
||||
def import_config(self, file=None, send_events=False):
|
||||
super().import_config(file, send_events)
|
||||
self.successful_import = True
|
||||
|
||||
@property
|
||||
def pins(self) -> List[dict]:
|
||||
return list(self._config.get('pins', []))
|
||||
|
|
|
|||
|
|
@ -909,10 +909,6 @@ class VideoDownloaderConfig(ConfigFile):
|
|||
def strict_codecs(self, value: bool):
|
||||
self.update({**self._config, 'strict_codecs': value})
|
||||
|
||||
def import_config(self, file: pathlib.Path = None, send_events=False):
|
||||
super().import_config(file, send_events)
|
||||
self.successful_import = True
|
||||
|
||||
|
||||
VIDEOS_DOWNLOADER_CONFIG: VideoDownloaderConfig = VideoDownloaderConfig()
|
||||
TEST_VIDEOS_DOWNLOADER_CONFIG: VideoDownloaderConfig = None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue