mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add absent to ssh_auth state
This commit is contained in:
parent
ef4369dd43
commit
ced7905b6b
1 changed files with 15 additions and 1 deletions
|
@ -34,4 +34,18 @@ def present(
|
|||
ret['comment'] = 'The authorized host key {0} for user {1} was added'.format(name, user)
|
||||
return ret
|
||||
|
||||
|
||||
def absent(name, user, config='.ssh/authorized_keys'):
|
||||
'''
|
||||
Verifies that the specified ssh key is absent
|
||||
'''
|
||||
ret = {'name': name,
|
||||
'changes': {},
|
||||
'result': True,
|
||||
'comment': ''}
|
||||
ret['comment'] = __salt__['ssh.rm_auth_key'](user, name, config)
|
||||
if ret['comment'] == 'User authorized keys file not present':
|
||||
ret['result'] = False
|
||||
return ret
|
||||
elif ret['comment'] == 'Key removed':
|
||||
ret['changes'][name] = 'Removed'
|
||||
return ret
|
||||
|
|
Loading…
Add table
Reference in a new issue