distgit: os.link fails if the dest already exists
This commit is contained in:
parent
8b12100a83
commit
015c24618c
1 changed files with 7 additions and 1 deletions
|
@ -14,6 +14,7 @@ import grp
|
||||||
import pwd
|
import pwd
|
||||||
import syslog
|
import syslog
|
||||||
import smtplib
|
import smtplib
|
||||||
|
import errno
|
||||||
|
|
||||||
import fedmsg
|
import fedmsg
|
||||||
import fedmsg.config
|
import fedmsg.config
|
||||||
|
@ -179,7 +180,12 @@ def main():
|
||||||
if hash_type == "md5":
|
if hash_type == "md5":
|
||||||
old_dir = os.path.join(module_dir, filename, checksum)
|
old_dir = os.path.join(module_dir, filename, checksum)
|
||||||
os.makedirs(old_dir)
|
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.
|
# Emit a fedmsg message. Load the config to talk to the fedmsg-relay.
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue