From b0639bb7effd411a28fd7950b11a1a5cbe43161e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Holger=20Wei=C3=9F?= Date: Tue, 5 Jul 2011 23:55:25 +0200 Subject: bcfg2-admin compare -r: Check for removed files When the "-r" flag is used, check for files which are present in the old directory but not in the new directory (not just the other way round). --- src/lib/Server/Admin/Compare.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/lib/Server/Admin/Compare.py b/src/lib/Server/Admin/Compare.py index 27e1478d1..e6b273176 100644 --- a/src/lib/Server/Admin/Compare.py +++ b/src/lib/Server/Admin/Compare.py @@ -124,7 +124,11 @@ class Compare(Bcfg2.Server.Admin.Mode): args.remove('-r') (oldd, newd) = args (old, new) = [os.listdir(spot) for spot in args] + old_extra = [] for item in old: + if item not in new: + old_extra.append(item) + continue print("File: %s" % item) state = self.__call__([oldd + '/' + item, newd + '/' + item]) new.remove(item) @@ -134,6 +138,8 @@ class Compare(Bcfg2.Server.Admin.Mode): print("File %s is bad" % item) if new: print("%s has extra files: %s" % (newd, ', '.join(new))) + if old_extra: + print("%s has extra files: %s" % (oldd, ', '.join(old_extra))) return try: (old, new) = args -- cgit v1.2.3-1-g7c22