mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-06 18:14:16 +00:00
adjusted tests for --clean-deleted-relations command
This commit is contained in:
@@ -29,6 +29,7 @@ class AdminFuncs:
|
||||
"""
|
||||
|
||||
def add_args(self, parser: argparse.ArgumentParser) -> None:
|
||||
self.parser = parser
|
||||
group = parser.add_argument_group('Admin tasks')
|
||||
objs = group.add_mutually_exclusive_group(required=True)
|
||||
objs.add_argument('--warm', action='store_true',
|
||||
@@ -89,6 +90,8 @@ class AdminFuncs:
|
||||
return 0
|
||||
|
||||
if args.clean_deleted:
|
||||
if not args.age:
|
||||
self.parser.error('Age is required for --clean-deleted command')
|
||||
LOG.warning('Cleaning up deleted relations')
|
||||
from ..tools import admin
|
||||
admin.clean_deleted_relations(args.config, age=args.age)
|
||||
|
||||
@@ -90,12 +90,9 @@ def analyse_indexing(config: Configuration, osm_id: Optional[str] = None,
|
||||
print(msg)
|
||||
|
||||
|
||||
def clean_deleted_relations(config: Configuration, age: Optional[str] = None) -> None:
|
||||
def clean_deleted_relations(config: Configuration, age: str) -> None:
|
||||
""" Clean deleted relations older than a given age
|
||||
"""
|
||||
if not age:
|
||||
LOG.fatal('No age given to delete relations')
|
||||
raise UsageError('Age parameter not found')
|
||||
with connect(config.get_libpq_dsn()) as conn:
|
||||
with conn.cursor() as cur:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user