From b14a872fad1911969ece3ec7e7563343780b44ab Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Wed, 17 Jul 2024 23:43:19 +0200 Subject: [PATCH] Fix "pmbootstrap config args /new/path" (MR 2374) Fix writing config options that are stored as CSV-list. Without this patch: $ pmbootstrap config aports /tmp/pmaports [23:43:58] Config changed: aports='/tmp/pmaports' $ pmbootstrap config aports [PosixPath('/'), PosixPath('t'), PosixPath('m'), PosixPath('p'), PosixPath('/'), PosixPath('p'), PosixPath('m'), PosixPath('a'), PosixPath('p'), PosixPath('o'), PosixPath('r'), PosixPath('t'), PosixPath('s')] Storing strings as CSV list isn't great and we probably want to implement this more elegantly, see the related issue. But let's fix this first. Related: pmbootstrap issue 2412 --- pmb/helpers/frontend.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pmb/helpers/frontend.py b/pmb/helpers/frontend.py index 3fcea6c5..0a47cb68 100644 --- a/pmb/helpers/frontend.py +++ b/pmb/helpers/frontend.py @@ -242,7 +242,10 @@ 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: - setattr(config, args.name, args.value) + if isinstance(getattr(Config, args.name), list): + setattr(config, args.name, args.value.split(",")) + else: + setattr(config, args.name, args.value) logging.info("Config changed: " + args.name + "='" + args.value + "'") pmb.config.save(args.config, config) elif args.name: