summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
Diffstat (limited to 'cloudinit')
-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