summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2007-11-07 14:52:38 -0500
committerMichael DeHaan <mdehaan@redhat.com>2007-11-07 14:52:38 -0500
commit994bc645a14be552257914e4c49a5ec7ec90fc30 (patch)
treef9fcc4f2bc27196fc3ca5a0879daf5c13963504e
parente1482f178a029703f8f9b5991366cf6008e48436 (diff)
downloadthird_party-cobbler-994bc645a14be552257914e4c49a5ec7ec90fc30.tar.gz
third_party-cobbler-994bc645a14be552257914e4c49a5ec7ec90fc30.tar.xz
third_party-cobbler-994bc645a14be552257914e4c49a5ec7ec90fc30.zip
Make copyfile understand that if it can't copy a file to itself it shouldn't
fail the operation.
-rw-r--r--cobbler/action_sync.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/cobbler/action_sync.py b/cobbler/action_sync.py
index e6bce25..47586d1 100644
--- a/cobbler/action_sync.py
+++ b/cobbler/action_sync.py
@@ -960,8 +960,11 @@ class BootSync:
def copyfile(self,src,dst):
try:
return shutil.copyfile(src,dst)
- except IOError, ioe:
- raise CX(_("Error copying %(src)s to %(dst)s") % { "src" : src, "dst" : dst})
+ except:
+ if not os.path.samefile(src,dst):
+ # accomodate for the possibility that we already copied
+ # the file as a symlink/hardlink
+ raise CX(_("Error copying %(src)s to %(dst)s") % { "src" : src, "dst" : dst})
def rmfile(self,path):
try: