Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
nomad-FAIR
Commits
fd9f6a27
Commit
fd9f6a27
authored
Apr 01, 2022
by
Markus Scheidgen
Browse files
Resolve "Keycloak users with unexpected attributes create processing errors."
parent
ef61f7ce
Changes
2
Hide whitespace changes
Inline
Side-by-side
nomad/infrastructure.py
View file @
fd9f6a27
...
...
@@ -308,6 +308,7 @@ class Keycloak():
kwargs
=
{
key
:
value
[
0
]
for
key
,
value
in
keycloak_user
.
get
(
'attributes'
,
{}).
items
()}
oasis_admin
=
kwargs
.
pop
(
'is_oasis_admin'
,
None
)
is
not
None
return
datamodel
.
User
(
m_ignore_additional_keys
=
True
,
user_id
=
keycloak_user
[
'id'
],
email
=
keycloak_user
.
get
(
'email'
),
username
=
keycloak_user
.
get
(
'username'
),
...
...
nomad/metainfo/metainfo.py
View file @
fd9f6a27
...
...
@@ -1292,30 +1292,28 @@ class MSection(metaclass=MObjectMeta): # TODO find a way to make this a subclas
return
cast
(
MSectionBound
,
sub_section
)
def
m_update
(
self
,
safe
:
bool
=
Tru
e
,
**
kwargs
):
def
m_update
(
self
,
m_ignore_additional_keys
:
bool
=
Fals
e
,
**
kwargs
):
''' Updates all quantities and sub-sections with the given arguments. '''
self
.
m_mod_count
+=
1
if
safe
:
for
name
,
value
in
kwargs
.
items
():
prop
=
self
.
m_def
.
all_aliases
.
get
(
name
,
None
)
if
prop
is
None
:
raise
KeyError
(
'%s is not an attribute of this section %s'
%
(
name
,
self
))
if
isinstance
(
prop
,
SubSection
):
if
prop
.
repeats
:
if
isinstance
(
value
,
List
):
for
item
in
value
:
self
.
m_add_sub_section
(
prop
,
item
)
else
:
raise
TypeError
(
'Sub section %s repeats, but no list was given'
%
prop
.
name
)
else
:
self
.
m_add_sub_section
(
prop
,
value
)
for
name
,
value
in
kwargs
.
items
():
prop
=
self
.
m_def
.
all_aliases
.
get
(
name
,
None
)
if
prop
is
None
:
if
m_ignore_additional_keys
:
continue
raise
KeyError
(
'%s is not an attribute of this section %s'
%
(
name
,
self
))
if
isinstance
(
prop
,
SubSection
):
if
prop
.
repeats
:
if
isinstance
(
value
,
List
):
for
item
in
value
:
self
.
m_add_sub_section
(
prop
,
item
)
else
:
raise
TypeError
(
'Sub section %s repeats, but no list was given'
%
prop
.
name
)
else
:
self
.
m_
set
(
prop
,
value
)
self
.
m_
add_sub_section
(
prop
,
value
)
else
:
self
.
__dict__
.
update
(
**
kwargs
)
else
:
self
.
m_set
(
prop
,
value
)
def
m_as
(
self
,
section_cls
:
Type
[
MSectionBound
])
->
MSectionBound
:
''' 'Casts' this section to the given extending sections. '''
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment