From b3e6aa54f75dba69ea58797c04751b104b406136 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Mon, 12 May 2008 16:12:29 -0400 Subject: Make duplicate mac checking work in more places, nicer error when encountering rootsquash. --- cobbler/commands.py | 11 ++++++----- cobbler/utils.py | 11 +++++++---- 2 files changed, 13 insertions(+), 9 deletions(-) (limited to 'cobbler') 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: -- cgit