This will allow the authorized_module to accept options that can be passed multiple times into ssh options. For instance permitopen.
This commit is contained in:
parent
88e4e1af18
commit
6d6b8a1823
1 changed files with 13 additions and 4 deletions
|
@ -169,7 +169,7 @@ class keydict(dict):
|
|||
def __iter__(self):
|
||||
return iter(self.itemlist)
|
||||
def keys(self):
|
||||
return self.itemlist
|
||||
return list(set(self.itemlist))
|
||||
def values(self):
|
||||
return [self[key] for key in self]
|
||||
def itervalues(self):
|
||||
|
@ -254,6 +254,12 @@ def parseoptions(module, options):
|
|||
for part in parts:
|
||||
if "=" in part:
|
||||
(key, value) = part.split("=", 1)
|
||||
if options_dict.has_key(key):
|
||||
if isinstance(options_dict[key], list):
|
||||
options_dict[key].append(value)
|
||||
else:
|
||||
options_dict[key] = [options_dict[key], value]
|
||||
else:
|
||||
options_dict[key] = value
|
||||
elif part != ",":
|
||||
options_dict[part] = None
|
||||
|
@ -348,10 +354,13 @@ def writekeys(module, filename, keys):
|
|||
option_strings = []
|
||||
for option_key in options.keys():
|
||||
if options[option_key]:
|
||||
if isinstance(options[option_key], list):
|
||||
for value in options[option_key]:
|
||||
option_strings.append("%s=%s" % (option_key, value))
|
||||
else:
|
||||
option_strings.append("%s=%s" % (option_key, options[option_key]))
|
||||
else:
|
||||
option_strings.append("%s" % option_key)
|
||||
|
||||
option_str = ",".join(option_strings)
|
||||
option_str += " "
|
||||
key_line = "%s%s %s %s\n" % (option_str, type, keyhash, comment)
|
||||
|
|
Loading…
Reference in a new issue