From a5a2aceeea812d703920d86eb00b1ee59f16b4d1 Mon Sep 17 00:00:00 2001 From: Thomas S Hatch Date: Fri, 13 Apr 2012 16:02:49 -0600 Subject: [PATCH] Add check_keyfile function to ssh module --- salt/modules/ssh.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/salt/modules/ssh.py b/salt/modules/ssh.py index 70e4b0e098..70a37d0cc5 100644 --- a/salt/modules/ssh.py +++ b/salt/modules/ssh.py @@ -174,6 +174,21 @@ def auth_keys(user, config='.ssh/authorized_keys'): return _validate_keys(full) +def check_key_file(user, keysource, config='.ssh/authorized_keys'): + ''' + Check a keyfile from a source destination against the local keys and + return the keys to change + ''' + ret = {} + keyfile = __salt__['cp.cahce_file'](keysource) + if not keyfile: + return ret + s_keys = _validate_keys(keyfile) + for key in s_keys: + ret[key] = check_key(user, k_keys[key], config) + return ret + + def check_key(user, key, config='.ssh/authorized_keys'): ''' Check to see if a key needs updating, returns "update", "add" or "exists"