Make pruning use the correct config and clean up *before* running tests, too.
[mailshears.git] / lib / prune / prune_runner.rb
1 require 'common/runner'
2 require 'prune/plugins/postfixadmin'
3 require 'rm/rm_runner'
4
5 class PruneRunner
6 include Runner
7
8 def run(cfg, plugin)
9 # We don't want to check the PostfixAdmin database against itself.
10 return if plugin.class == PostfixadminPrune
11
12 pfa = PostfixadminPrune.new(cfg)
13
14 db_users = pfa.list_users()
15 db_domains = pfa.list_domains()
16
17 leftovers = plugin.get_leftover_users(db_users)
18 leftovers += plugin.get_leftover_domains(db_domains)
19
20 rm_runner = RmRunner.new()
21 rm_runner.run(cfg, plugin, *leftovers)
22 end
23
24 end