From 7077358b1a262e3db384eb3218628632d3a6cc31 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Thu, 2 May 2013 00:30:52 +0200 Subject: Client/Tools/POSIX: catch multiple VerifyDirectory calls If a directory should be pruned from all unknown files VerifyDirectory created a new entry each call and the second fails because the file was already removed. --- src/lib/Client/Tools/POSIX.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/lib/Client/Tools/POSIX.py b/src/lib/Client/Tools/POSIX.py index 049b90d32..5e1507bbd 100644 --- a/src/lib/Client/Tools/POSIX.py +++ b/src/lib/Client/Tools/POSIX.py @@ -116,6 +116,7 @@ class POSIX(Bcfg2.Client.Tools.Tool): setup.parse([]) ppath = setup['ppath'] max_copies = setup['max_copies'] + prune_list = list() def canInstall(self, entry): """Check if entry is complete for installation.""" @@ -304,7 +305,7 @@ class POSIX(Bcfg2.Client.Tools.Tool): try: entries = ['/'.join([entry.get('name'), ent]) \ for ent in os.listdir(entry.get('name'))] - ex_ents = [e for e in entries if e not in modlist] + ex_ents = [e for e in entries if e not in modlist and e not in self.prune_list] if ex_ents: pruneTrue = False self.logger.debug("Directory %s contains extra entries:" % \ @@ -317,6 +318,7 @@ class POSIX(Bcfg2.Client.Tools.Tool): entry.set('qtest', nqtext) [entry.append(XML.Element('Prune', path=x)) \ for x in ex_ents] + self.prune_list += ex_ents except OSError: ex_ents = [] pruneTrue = True -- cgit v1.2.3-1-g7c22