mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-03-25 08:55:50 +00:00
fix(repair_collection): use DiscoverResult logic to discover collection
fixes error: `DAVSession.__init__() missing 1 required keyword-only argument: 'connector'`. Reuses the existing logic in DiscoverResult to determine if the storage requires a 'connector' arg.
This commit is contained in:
parent
246568f149
commit
efad9eb624
2 changed files with 7 additions and 6 deletions
|
|
@ -76,8 +76,8 @@ async def collections_for_pair(
|
|||
|
||||
logger.info(f"Discovering collections for pair {pair.name}")
|
||||
|
||||
a_discovered = _DiscoverResult(pair.config_a, connector=connector)
|
||||
b_discovered = _DiscoverResult(pair.config_b, connector=connector)
|
||||
a_discovered = DiscoverResult(pair.config_a, connector=connector)
|
||||
b_discovered = DiscoverResult(pair.config_b, connector=connector)
|
||||
|
||||
if list_collections:
|
||||
# TODO: We should gather data and THEN print, so it can be async.
|
||||
|
|
@ -155,7 +155,7 @@ def _expand_collections_cache(collections, config_a, config_b):
|
|||
yield name, (a, b)
|
||||
|
||||
|
||||
class _DiscoverResult:
|
||||
class DiscoverResult:
|
||||
def __init__(self, config, *, connector):
|
||||
self._cls, _ = storage_class_from_config(config)
|
||||
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ import aiohttp
|
|||
from .. import exceptions
|
||||
from .. import sync
|
||||
from .config import CollectionConfig
|
||||
from .discover import DiscoverResult
|
||||
from .discover import collections_for_pair
|
||||
from .discover import storage_class_from_config
|
||||
from .discover import storage_instance_from_config
|
||||
from .utils import JobFailed
|
||||
from .utils import cli_logger
|
||||
|
|
@ -115,8 +115,9 @@ async def repair_collection(
|
|||
|
||||
if collection is not None:
|
||||
cli_logger.info("Discovering collections (skipping cache).")
|
||||
cls, config = storage_class_from_config(config)
|
||||
async for config in cls.discover(**config): # noqa E902
|
||||
get_discovered = DiscoverResult(config, connector=connector)
|
||||
discovered = await get_discovered.get_self()
|
||||
for config in discovered.values():
|
||||
if config["collection"] == collection:
|
||||
break
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in a new issue