From db3766eaa280f57d4449df995b0d8a7c5c8ec143 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A5=D0=B8=D1=80=D0=B5=D1=86=D0=BA=D0=B8=D0=B9=20=D0=9C?= =?UTF-8?q?=D0=B8=D1=85=D0=B0=D0=B8=D0=BB?= Date: Tue, 25 May 2021 10:38:20 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20=D0=B2=D1=8B=D0=B1=D0=BE=D1=80=20=D0=B3=D1=80?= =?UTF-8?q?=D1=83=D0=BF=D0=BF=20=D0=BD=D0=B0=20CSS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pym/install/variables/system.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/pym/install/variables/system.py b/pym/install/variables/system.py index 8ef69c4..011137f 100644 --- a/pym/install/variables/system.py +++ b/pym/install/variables/system.py @@ -421,6 +421,23 @@ class VariableClMigrateAdmin(UserHelper, Variable): return map(lambda x: x if x else self.default_value, value) +class VariableOsAvailableGroups(ReadonlyVariable): + """ + Список доступных в дистрибутиве групп + """ + type = 'list' + + def get(self): + image = self.Get('cl_image') + if image: + with image: + try: + distrPath = image.getDirectory() + return getGroups(distrPath) + except DistributiveError: + pass + return getGroups() + class VariableClMigrateUserGroups(UserHelper, Variable): """ Migrate users groups @@ -442,15 +459,17 @@ class VariableClMigrateUserGroups(UserHelper, Variable): return value def getDefaultGroups(self): - return list(set(self.defaultGroupList) & set(getGroups())) + return list(set(self.defaultGroupList) & set(self.Get('os_available_groups'))) def init(self): self.label = _("Groups") def process_groups(self, values): + groupslist = list(set(self.defaultGroupList) + & set(self.Get('os_available_groups'))) for value in values: if value == self.default_value: - for i in self.defaultGroupList: + for i in groupslist: yield i else: yield value