summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG1
-rw-r--r--cobbler/remote.py10
-rw-r--r--cobbler/utils.py13
3 files changed, 17 insertions, 7 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 079a790..32ff3e0 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -12,6 +12,7 @@ Cobbler CHANGELOG
- if repos in profiles no longer exist, remove noisy warning, move to "check"
- move warning about reposync to check also (check is more useful at runtime now)
- build pxe trees for systems even if interface0 is undefined
+- add sync() back into XMLRPC API, missing in 0.9.1
- Fri May 09 2008 - 0.9.1
- patch to allow yumopts to override gpgcheck
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: