bundles/users: fix adding of non-admin users
This commit is contained in:
parent
47c18913ca
commit
09397e2597
1 changed files with 4 additions and 3 deletions
|
@ -20,17 +20,18 @@ def add_users_from_json(metadata):
|
|||
json = loads(f.read())
|
||||
|
||||
users = {}
|
||||
metadata_users = metadata.get('users', {})
|
||||
# First, add all admin users
|
||||
for uname, config in json.items():
|
||||
if config.get('is_admin', False):
|
||||
if config.get('is_admin', False) or uname in metadata_users:
|
||||
users[uname] = {
|
||||
'ssh_pubkey': set(config['ssh_pubkey']),
|
||||
'is_admin': True,
|
||||
'is_admin': config.get('is_admin', False),
|
||||
}
|
||||
|
||||
# Then, run again to get all 'to be deleted' users
|
||||
for uname, config in json.items():
|
||||
if uname not in metadata.get('users', {}):
|
||||
if uname not in metadata_users:
|
||||
users.setdefault(uname, {
|
||||
'delete': True,
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue