summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-06-29 13:46:19 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2012-06-29 13:46:19 -0700
commit25df1844285a48cd4ba0226c9c65e66973374845 (patch)
treee53d00f5c8064341a919c135414640750591d566
parentb4c9e36721965d6b15a35c1c4b035e3656dd547e (diff)
downloadvyos-cloud-init-25df1844285a48cd4ba0226c9c65e66973374845.tar.gz
vyos-cloud-init-25df1844285a48cd4ba0226c9c65e66973374845.zip
Don't remove the key if its not there (or was already removed)
-rw-r--r--cloudinit/ssh_util.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/cloudinit/ssh_util.py b/cloudinit/ssh_util.py
index fc8b9b3d..e0a2f0ca 100644
--- a/cloudinit/ssh_util.py
+++ b/cloudinit/ssh_util.py
@@ -197,7 +197,8 @@ def update_authorized_keys(fname, keys):
# Replace it with our better one
ent = k
# Don't add it later
- to_add.remove(k)
+ if k in to_add:
+ to_add.remove(k)
entries[i] = ent
# Now append any entries we did not match above