Only remove the pending key if it exists

This commit is contained in:
K Jonathan Harker 2012-10-26 23:24:37 +00:00
parent d3edc88bae
commit 5f866ad9f1

View File

@ -98,9 +98,10 @@ def accept_key(pki_dir, pub, id_):
pki_dir,
'minions_pre/{0}'.format(id_)
)
with open(oldkey) as fp_:
if fp_.read() == pub:
os.remove(oldkey)
if os.path.isfile(oldkey):
with open(oldkey) as fp_:
if fp_.read() == pub:
os.remove(oldkey)
def remove_key(pki_dir, id_):