enable lock for web service

This commit is contained in:
2023-01-18 01:39:55 +02:00
parent e6888ba788
commit f4abd83568
4 changed files with 21 additions and 5 deletions

View File

@ -929,7 +929,8 @@ def _set_web_parser(root: SubParserAction) -> argparse.ArgumentParser:
argparse.ArgumentParser: created argument parser
"""
parser = root.add_parser("web", help="web server", description="start web server", formatter_class=_formatter)
parser.set_defaults(handler=handlers.Web, lock=None, report=False, parser=_parser)
parser.set_defaults(handler=handlers.Web, lock=Path(tempfile.gettempdir()) / "ahriman-web.lock", report=False,
parser=_parser)
return parser

View File

@ -21,7 +21,6 @@ from __future__ import annotations
import argparse
from pathlib import Path
from types import TracebackType
from typing import Literal, Optional, Type
@ -68,7 +67,8 @@ class Lock(LazyLogging):
architecture(str): repository architecture
configuration(Configuration): configuration instance
"""
self.path = Path(f"{args.lock}_{architecture}") if args.lock is not None else None
self.path = args.lock.with_stem(f"{args.lock.stem}_{architecture}") if args.lock is not None else None
print(self.path)
self.force = args.force
self.unsafe = args.unsafe