distgit: os.link fails if the dest already exists

This commit is contained in:
Mathieu Bridon 2015-05-29 18:00:16 +02:00
parent 8b12100a83
commit 015c24618c

View file

@ -14,6 +14,7 @@ import grp
import pwd
import syslog
import smtplib
import errno
import fedmsg
import fedmsg.config
@ -179,7 +180,12 @@ def main():
if hash_type == "md5":
old_dir = os.path.join(module_dir, filename, checksum)
os.makedirs(old_dir)
os.link(dest_file, os.path.join(old_dir, filename))
try:
os.link(dest_file, os.path.join(old_dir, filename))
except OSError as e:
if e.errno != errno.EEXIST:
raise e
# Emit a fedmsg message. Load the config to talk to the fedmsg-relay.
try: