agent/authentic2: fix provisionning of attributes when an attribute is disabled (#22751)

Attribute.objects.get_or_create() can fail on an existing attribute as
the default "objects" manager of the Attribute model hide disabled
attributes, so the get() can fail but won't be able to create the
attribute.
This commit is contained in:
Benjamin Dauvergne 2018-03-22 22:12:50 +01:00 committed by Frédéric Péters
parent 79da1603bd
commit 411e94363a
1 changed files with 1 additions and 1 deletions

View File

@ -68,7 +68,7 @@ class Command(hobo_deploy.Command):
# so it gets shared as SAML attribute.
fields.append(attribute['name'])
continue
attr, created = Attribute.objects.get_or_create(
attr, created = Attribute.all_objects.get_or_create(
name=attribute['name'],
defaults={'kind': attribute['kind']})
for key in ('label', 'description', 'asked_on_registration',