summaryrefslogtreecommitdiffstats
path: root/cobbler
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2008-05-13 17:18:16 -0400
committerMichael DeHaan <mdehaan@redhat.com>2008-05-13 17:18:16 -0400
commitb7217f4730ed54abaec95855a682c5c9f3b73870 (patch)
tree6cd4bef7d08af1e117d69aed450b6d38d2a70429 /cobbler
parent0f60b1a19ef32c63c591905b9640ebb60684f442 (diff)
downloadthird_party-cobbler-b7217f4730ed54abaec95855a682c5c9f3b73870.tar.gz
third_party-cobbler-b7217f4730ed54abaec95855a682c5c9f3b73870.tar.xz
third_party-cobbler-b7217f4730ed54abaec95855a682c5c9f3b73870.zip
Change the way error checking works around NFS read errors (root squash)
Diffstat (limited to 'cobbler')
-rw-r--r--cobbler/remote.py10
-rw-r--r--cobbler/utils.py13
2 files changed, 16 insertions, 7 deletions
diff --git a/cobbler/remote.py b/cobbler/remote.py
index 8cf9ba3..69754a3 100644
--- a/cobbler/remote.py
+++ b/cobbler/remote.py
@@ -747,6 +747,16 @@ class CobblerReadWriteXMLRPCInterface(CobblerXMLRPCInterface):
return self.object_cache[object_id][0]
raise CX(_("No such object for ID: %s") % object_id)
+ def sync(self,token):
+ """
+ Run sync code, which should complete before XMLRPC timeout. We can't
+ do reposync this way. Would be nice to send output over AJAX/other
+ later.
+ """
+ self.log("sync",token=token)
+ self.check_access(token,"sync")
+ return self.api.sync()
+
def new_distro(self,token):
"""
Creates a new (unconfigured) distro object. It works something like
diff --git a/cobbler/utils.py b/cobbler/utils.py
index c62ec6c..6e756c9 100644
--- a/cobbler/utils.py
+++ b/cobbler/utils.py
@@ -590,13 +590,12 @@ def copyfile(src,dst):
try:
return shutil.copyfile(src,dst)
except:
- try:
- 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})
- except:
- raise CX(_("Problems reading %(src)s") % { "src" : src})
+ if not os.access(src,os.R_OK):
+ raise CX(_("Cannot read: %s") % src)
+ 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(path):
try: