From 25df1844285a48cd4ba0226c9c65e66973374845 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Fri, 29 Jun 2012 13:46:19 -0700 Subject: Don't remove the key if its not there (or was already removed) --- cloudinit/ssh_util.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'cloudinit/ssh_util.py') 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 -- cgit v1.2.3