mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-11-16 13:33:42 +00:00
support of new schema in systemd units
This commit is contained in:
@ -83,6 +83,9 @@ def _parser() -> argparse.ArgumentParser:
|
||||
action=argparse.BooleanOptionalAction, default=True)
|
||||
parser.add_argument("-r", "--repository", help="target repository. For several subcommands it can be used "
|
||||
"multiple times", action="append")
|
||||
# special secret argument for systemd unit. The issue is that systemd doesn't allow multiple arguments to template
|
||||
# name. This parameter accepts [[arch]-repo] in order to keep backward compatibility
|
||||
parser.add_argument("--repository-id", help=argparse.SUPPRESS)
|
||||
parser.add_argument("-q", "--quiet", help="force disable any logging", action="store_true")
|
||||
parser.add_argument("--unsafe", help="allow to run ahriman as non-ahriman user. Some actions might be unavailable",
|
||||
action="store_true")
|
||||
|
||||
@ -124,6 +124,15 @@ class Handler:
|
||||
# pylint, wtf???
|
||||
root = configuration.getpath("repository", "root") # pylint: disable=assignment-from-no-return
|
||||
|
||||
# preparse systemd repository-id argument
|
||||
# we are using unescaped values, so / is not allowed here, because it is impossible to separate if from dashes
|
||||
if args.repository_id is not None:
|
||||
# repository parts is optional for backward compatibility
|
||||
architecture, *repository_parts = args.repository_id.split("/")
|
||||
args.architecture = [architecture]
|
||||
if repository_parts:
|
||||
args.repository = ["-".join(repository_parts)] # replace slash with dash
|
||||
|
||||
# extract repository names first
|
||||
names = args.repository
|
||||
if names is None: # try to read file system first
|
||||
|
||||
Reference in New Issue
Block a user