summaryrefslogtreecommitdiff
path: root/cloudinit/ssh_util.py
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-06-16 13:43:31 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2012-06-16 13:43:31 -0700
commit54bbf3b7c59352ca8482abab5728d8621c9888fe (patch)
tree8291702d122a621b578f6b68be8264bd2c419f0c /cloudinit/ssh_util.py
parenta5e15033e70ec3cea877879d0070480f6a7efe49 (diff)
downloadvyos-cloud-init-54bbf3b7c59352ca8482abab5728d8621c9888fe.tar.gz
vyos-cloud-init-54bbf3b7c59352ca8482abab5728d8621c9888fe.zip
Comments as to why we are using a csv parser and do some of the logic checks that are done for option extraction
Diffstat (limited to 'cloudinit/ssh_util.py')
-rw-r--r--cloudinit/ssh_util.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/cloudinit/ssh_util.py b/cloudinit/ssh_util.py
index f6941a29..ba252e7f 100644
--- a/cloudinit/ssh_util.py
+++ b/cloudinit/ssh_util.py
@@ -79,12 +79,22 @@ class AuthKeyEntry(object):
options = ent[0:i]
options_lst = []
+
+ # Now use a csv parser to pull the options
+ # out of the above string that we just found an endpoint for.
+ #
+ # No quoting so we don't mess up any of the quoting that
+ # is already there.
reader = csv.reader(StringIO(options), quoting=csv.QUOTE_NONE)
for row in reader:
for e in row:
+ # Only keep non-empty csv options
e = e.strip()
if e:
options_lst.append(e)
+
+ # Now take the rest of the items before the string
+ # as long as there is room to do this...
toks = []
if i + 1 < len(ent):
toks = ent[i + 1:].split(None, 3)