diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Client/Tools/POSIX.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/lib/Client/Tools/POSIX.py b/src/lib/Client/Tools/POSIX.py index 5f380023b..dd8272749 100644 --- a/src/lib/Client/Tools/POSIX.py +++ b/src/lib/Client/Tools/POSIX.py @@ -116,7 +116,7 @@ class POSIX(Bcfg2.Client.Tools.Tool): setup.parse([]) ppath = setup['ppath'] max_copies = setup['max_copies'] - prune_list = list() + prunes = dict() def canInstall(self, entry): """Check if entry is complete for installation.""" @@ -305,7 +305,10 @@ 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 and e not in self.prune_list] + prune_list = list() + if entry.get('name') in self.prunes: + prune_list = self.prunes[entry.get('name')] + ex_ents = [e for e in entries if e not in modlist and e not in prune_list] if ex_ents: pruneTrue = False self.logger.debug("Directory %s contains extra entries:" % \ @@ -318,8 +321,11 @@ 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 - elif self.prune_list: + if entry.get('name') not in self.prunes: + self.prunes[entry.get('name')] = list() + self.prunes[entry.get('name')] += ex_ents + elif entry.get('name') in self.prunes \ + and len(self.prunes[entry.get('name')]) > 0: pruneTrue = False except OSError: ex_ents = [] @@ -443,6 +449,8 @@ class POSIX(Bcfg2.Client.Tools.Tool): try: self.logger.debug("Unlinking file %s" % pname) os.unlink(pname) + if entry.get('name') in self.prunes: + self.prunes[entry.get('name')].remove(pname) except OSError: self.logger.error("Failed to unlink path %s" % pname) ulfailed = True |