From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id BA69F1382CD for ; Sat, 25 Jun 2016 15:46:53 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 67C5914120; Sat, 25 Jun 2016 15:46:52 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id B71DA14120 for ; Sat, 25 Jun 2016 15:46:51 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7B29D340C54 for ; Sat, 25 Jun 2016 15:46:50 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id B1D33241E for ; Sat, 25 Jun 2016 15:46:47 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1466869480.727d8118db98549b0cc48f3c56db842cf82b0c27.dolsen@gentoo> Subject: [gentoo-commits] proj/catalyst:master commit in: catalyst/ X-VCS-Repository: proj/catalyst X-VCS-Files: catalyst/fileops.py X-VCS-Directories: catalyst/ X-VCS-Committer: dolsen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: 727d8118db98549b0cc48f3c56db842cf82b0c27 X-VCS-Branch: master Date: Sat, 25 Jun 2016 15:46:47 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 44292ddf-dd97-4ef2-b336-d5d618286d4d X-Archives-Hash: cc953c1b4ccd3cda82313c3fd97dd2a6 commit: 727d8118db98549b0cc48f3c56db842cf82b0c27 Author: Brian Dolbec gentoo org> AuthorDate: Sat Jun 25 15:44:40 2016 +0000 Commit: Brian Dolbec gentoo org> CommitDate: Sat Jun 25 15:44:40 2016 +0000 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=727d8118 fileops.py: Fix a traceback clearing teh old profile link The isdir() cconditional was not enough, it also needed to make sure it was not a symlink. 25 Jun 2016 08:02:45 PDT: NOTICE : --- Running action sequence: config_profile_link 25 Jun 2016 08:02:45 PDT: ERROR : clear_dir failed Traceback (most recent call last): File "/home/brian/Dev/git/catalyst/catalyst/fileops.py", line 84, in clear_dir shutil.rmtree(target) File "/usr/lib64/python3.4/shutil.py", line 478, in rmtree onerror(os.path.islink, path, sys.exc_info()) File "/usr/lib64/python3.4/shutil.py", line 476, in rmtree raise OSError("Cannot call rmtree on a symbolic link") OSError: Cannot call rmtree on a symbolic link catalyst/fileops.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/catalyst/fileops.py b/catalyst/fileops.py index 6971911..d2bd453 100644 --- a/catalyst/fileops.py +++ b/catalyst/fileops.py @@ -70,7 +70,7 @@ def clear_dir(target, mode=0o755, chg_flags=False, remove=False, return False mystat = None - if os.path.isdir(target): + if os.path.isdir(target) and not os.path.islink(target): log.info('Emptying directory: %s', target) # stat the dir, delete the dir, recreate the dir and set # the proper perms and ownership @@ -87,6 +87,7 @@ def clear_dir(target, mode=0o755, chg_flags=False, remove=False, return False elif os.path.exists(target): if clear_nondir: + log.debug("Clearing (unlinking) non-directory: %s", target) os.unlink(target) else: log.info('clear_dir failed: %s: is not a directory', target)