Skip to content

Commit

Permalink
Fix irregularities in testing, update doc
Browse files Browse the repository at this point in the history
Testing with all permutations, this works great.
  • Loading branch information
Andrew Kuhnhausen committed Mar 27, 2012
1 parent 71cb79a commit 7cacb20
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions salt/states/ssh_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,17 @@
- present
- user: root
- enc: ssh-rsa
- options: option1="value1",option2="value2 flag2"
- options:
- option1="value1"
- option2="value2 flag2"
- comment: myuser
- names:
- AAAAB3NzaC1kc3MAAACBAL0sQ9fJ5bYTEyY==
- ssh-dss AAAAB3NzaCL0sQ9fJ5bYTEyY== user@domain
- option3="value3" ssh-dss AAAAB3NzaC1kcQ9fJ5bYTEyY== other@testdomain
- AAAAB3NzaC1kcQ9fJFF435bYTEyY== newcomment
'''

import re

def present(
name,
Expand Down Expand Up @@ -94,13 +96,13 @@ def present(
else:
# if there are options, set them
if fullkey.group(1):
options = fullkey.group(1).split(',')
options = fullkey.group(1)
# key is of format: {enc} {key} [comment]
comps = fullkey.group(2).split()
enc = comps[0]
name = comps[1]
if len(comps) == 3:
comment = comps[3]
comment = comps[2]

data = __salt__['ssh.set_auth_key'](
user,
Expand Down

0 comments on commit 7cacb20

Please sign in to comment.