mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-09-04 15:59:55 +00:00
Compare commits
2 Commits
ffc5c14177
...
b1c7dfa3c9
Author | SHA1 | Date | |
---|---|---|---|
b1c7dfa3c9 | |||
97b906c536 |
@ -272,12 +272,12 @@ class RepositoryPaths(LazyLogging):
|
||||
path = path or self.root
|
||||
|
||||
def walk(root: Path) -> Generator[Path, None, None]:
|
||||
for entry in root.iterdir():
|
||||
yield entry
|
||||
if entry in (self.chroot.parent,):
|
||||
yield from entry.iterdir()
|
||||
elif entry.is_dir():
|
||||
yield from walk(entry)
|
||||
for child in root.iterdir():
|
||||
yield child
|
||||
if child in (self.chroot.parent,):
|
||||
yield from child.iterdir()
|
||||
elif child.is_dir():
|
||||
yield from walk(child)
|
||||
|
||||
# get current filesystem and run action
|
||||
previous_snapshot = set(walk(path))
|
||||
|
@ -72,7 +72,7 @@ def _create_socket(configuration: Configuration, application: Application) -> so
|
||||
async def remove_socket(_: Application) -> None:
|
||||
unix_socket.unlink(missing_ok=True)
|
||||
|
||||
application.on_shutdown.append(remove_socket) # type: ignore[arg-type]
|
||||
application.on_shutdown.append(remove_socket)
|
||||
|
||||
return sock
|
||||
|
||||
@ -142,8 +142,8 @@ def setup_server(configuration: Configuration, spawner: Spawn, repositories: lis
|
||||
InitializeError: if no repositories set
|
||||
"""
|
||||
application = Application(logger=logging.getLogger(__name__))
|
||||
application.on_shutdown.append(_on_shutdown) # type: ignore[arg-type]
|
||||
application.on_startup.append(_on_startup) # type: ignore[arg-type]
|
||||
application.on_shutdown.append(_on_shutdown)
|
||||
application.on_startup.append(_on_startup)
|
||||
|
||||
application.middlewares.append(normalize_path_middleware(append_slash=False, remove_slash=True))
|
||||
application.middlewares.append(exception_handler(application.logger))
|
||||
@ -166,11 +166,16 @@ def setup_server(configuration: Configuration, spawner: Spawn, repositories: lis
|
||||
# package cache
|
||||
if not repositories:
|
||||
raise InitializeError("No repositories configured, exiting")
|
||||
database = SQLite.load(configuration)
|
||||
watchers: dict[RepositoryId, Watcher] = {}
|
||||
configuration_path, _ = configuration.check_loaded()
|
||||
for repository_id in repositories:
|
||||
application.logger.info("load repository %s", repository_id)
|
||||
client = Client.load(repository_id, configuration, database, report=False) # explicitly load local client
|
||||
# load settings explicitly for architecture if any
|
||||
repository_configuration = Configuration.from_path(configuration_path, repository_id)
|
||||
# load database instance, because it holds identifier
|
||||
database = SQLite.load(repository_configuration)
|
||||
# explicitly load local client
|
||||
client = Client.load(repository_id, repository_configuration, database, report=False)
|
||||
watchers[repository_id] = Watcher(client)
|
||||
application[WatcherKey] = watchers
|
||||
# workers cache
|
||||
|
Reference in New Issue
Block a user