From 62ebd68e34db8d0b00dc42aaa96668f2dd833343 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Thu, 16 Sep 2021 20:03:27 +0200 Subject: [PATCH] config/user question: raise an error if no user exists yet --- src/yunohost/utils/config.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/yunohost/utils/config.py b/src/yunohost/utils/config.py index a84b4cafe..630af1741 100644 --- a/src/yunohost/utils/config.py +++ b/src/yunohost/utils/config.py @@ -815,6 +815,14 @@ class UserQuestion(Question): super().__init__(question, user_answers) self.choices = user_list()["users"] + + if not self.choices: + raise YunohostValidationError( + "app_argument_invalid", + name=self.name, + error="You should create a YunoHost user first." + ) + if self.default is None: root_mail = "root@%s" % _get_maindomain() for user in self.choices.keys():