summaryrefslogtreecommitdiffstats
path: root/cobbler
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2008-05-12 16:12:29 -0400
committerMichael DeHaan <mdehaan@redhat.com>2008-05-12 16:12:29 -0400
commitb3e6aa54f75dba69ea58797c04751b104b406136 (patch)
tree05d9bf67771f6cbd963c9d8370312f0c81e0c5c4 /cobbler
parentaaf52ab85b518d8c6b4ed0211b69d6be531ae5a9 (diff)
downloadthird_party-cobbler-b3e6aa54f75dba69ea58797c04751b104b406136.tar.gz
third_party-cobbler-b3e6aa54f75dba69ea58797c04751b104b406136.tar.xz
third_party-cobbler-b3e6aa54f75dba69ea58797c04751b104b406136.zip
Make duplicate mac checking work in more places, nicer error when encountering rootsquash.
Diffstat (limited to 'cobbler')
-rw-r--r--cobbler/commands.py11
-rw-r--r--cobbler/utils.py11
2 files changed, 13 insertions, 9 deletions
diff --git a/cobbler/commands.py b/cobbler/commands.py
index 657934c..705249d 100644
--- a/cobbler/commands.py
+++ b/cobbler/commands.py
@@ -295,11 +295,12 @@ class CobblerFunction:
else:
rc = collect_fn().add(obj, save=True, with_sync=opt_sync, with_triggers=opt_triggers, check_for_duplicate_names=False, check_for_duplicate_netinfo=False)
else:
- # editing or copying (but not renaming), so duplicate netinfo
- # CAN be bad, duplicate names are already handled, though
- # we need to clean up checks around duplicate netinfo here
- # (FIXME) so they are made and work.
- rc = collect_fn().add(obj, save=True, with_sync=opt_sync, with_triggers=opt_triggers)
+ check_dup = False
+ if not "copy" in self.args:
+ check_dup = True
+ # FIXME: this ensures duplicate prevention on copy, but not
+ # rename?
+ rc = collect_fn().add(obj, save=True, with_sync=opt_sync, with_triggers=opt_triggers, check_for_duplicate_netinfo=check_dup)
else:
# we are renaming here, so duplicate netinfo checks also
diff --git a/cobbler/utils.py b/cobbler/utils.py
index 1b4b30a..a9b374f 100644
--- a/cobbler/utils.py
+++ b/cobbler/utils.py
@@ -590,10 +590,13 @@ def copyfile(src,dst):
try:
return shutil.copyfile(src,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})
+ 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})
def rmfile(path):
try: