remove users/$user/is_admin metadata, directly write sudo_commands instead
This commit is contained in:
parent
02e25f89ff
commit
7d4624ce62
7 changed files with 8 additions and 26 deletions
|
@ -1,9 +1,5 @@
|
|||
% for user, config in sorted(node.metadata['users'].items()):
|
||||
% if config.get('is_admin', False):
|
||||
${user} ALL=(ALL) NOPASSWD:ALL
|
||||
% else:
|
||||
% for p in sorted(config.get('sudo_commands', [])):
|
||||
% for p in sorted(config.get('sudo_commands', [])):
|
||||
${user} ALL=(ALL) NOPASSWD:${p}
|
||||
% endfor
|
||||
% endif
|
||||
% endfor
|
||||
% endfor
|
||||
|
|
|
@ -36,7 +36,7 @@ def add_users_from_json(metadata):
|
|||
if config.get('is_admin', False) or uname in metadata_users:
|
||||
users[uname] = {
|
||||
'ssh_pubkey': set(config['ssh_pubkey']),
|
||||
'is_admin': config.get('is_admin', False),
|
||||
'sudo_commands': ['ALL'],
|
||||
}
|
||||
|
||||
# Then, run again to get all 'to be deleted' users
|
||||
|
|
|
@ -52,7 +52,7 @@ if node.has_bundle('arch-with-gui'):
|
|||
def libvirt_group_for_admins(metadata):
|
||||
result = {}
|
||||
for user, config in metadata.get('users', {}).items():
|
||||
if config.get('is_admin', False):
|
||||
if 'ALL' in config.get('sudo_commands', set()):
|
||||
result[user] = {
|
||||
'groups': {
|
||||
'libvirt',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue