Also allow a dict to be used

When a dict is passed in for 'ssh_authorized_keys' just extract
the keys from the values of the dict (and discard the keys).
This commit is contained in:
Joshua Harlow 2014-10-21 12:00:53 -07:00
parent 9902b4e9e3
commit 29d3c6578b

View File

@ -391,10 +391,12 @@ class Distro(object):
keys = kwargs['ssh_authorized_keys']
if isinstance(keys, (basestring, str)):
keys = [keys]
if isinstance(keys, dict):
keys = list(keys.values())
if not isinstance(keys, (tuple, list, set)):
util.multi_log("Invalid type detected for"
" 'ssh_authorized_keys', expected list, string"
" or set.")
" , dict, or set.")
else:
keys = set(keys) or []
ssh_util.setup_user_keys(keys, name, options=None)