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