mirror of
https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git
synced 2025-07-13 11:29:46 +03:00
Fix pmbootstrap config mirrors.… <NEW_VALUE> (MR 2385)
Don't fail with: type object 'Config' has no attribute 'mirrors.pmaports' Fixes: issue 2420
This commit is contained in:
parent
08758bef90
commit
86d38d451b
1 changed files with 6 additions and 1 deletions
|
@ -242,7 +242,12 @@ def config(args: PmbArgs):
|
|||
logging.info(f"Config changed to default: {args.name}='{def_value}'")
|
||||
pmb.config.save(args.config, config)
|
||||
elif args.value is not None:
|
||||
if isinstance(getattr(Config, args.name), list):
|
||||
if args.name.startswith("mirrors."):
|
||||
name = args.name.split(".", 1)[1]
|
||||
# Ignore mypy 'error: TypedDict key must be a string literal'.
|
||||
# Argparse already ensures 'name' is a valid Config.Mirrors key.
|
||||
config.mirrors[name] = args.value # type: ignore
|
||||
elif isinstance(getattr(Config, args.name), list):
|
||||
setattr(config, args.name, args.value.split(","))
|
||||
else:
|
||||
setattr(config, args.name, args.value)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue