diff options
Diffstat (limited to 'lorrycontroller/readconf.py')
-rw-r--r-- | lorrycontroller/readconf.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/lorrycontroller/readconf.py b/lorrycontroller/readconf.py index 4a193b1..b455583 100644 --- a/lorrycontroller/readconf.py +++ b/lorrycontroller/readconf.py @@ -71,10 +71,11 @@ class ReadConfiguration(lorrycontroller.LorryControllerRoute): lorries_to_remove = lorries_to_remove.difference(added) elif section['type'] in ('trove', 'troves'): self.add_trove(statedb, section) - if section['trovehost'] in troves_to_remove: - troves_to_remove.remove(section['trovehost']) - lorries_to_remove = self.without_lorries_for_trovehost( - statedb, lorries_to_remove, section['trovehost']) + trovehost = section['trovehost'] + if trovehost in troves_to_remove: + troves_to_remove.remove(trovehost) + lorries_to_remove = lorries_to_remove.difference( + statedb.get_lorries_for_trove(trovehost)) else: logging.error( 'Unknown section in configuration: %r', section) @@ -94,10 +95,6 @@ class ReadConfiguration(lorrycontroller.LorryControllerRoute): return 'Configuration has been updated.' - def without_lorries_for_trovehost(self, statedb, lorries, trovehost): - for_trovehost = statedb.get_lorries_for_trove(trovehost) - return set(x for x in lorries if x not in for_trovehost) - def get_confgit(self): if self.app_settings['debug-real-confgit']: confdir = self.app_settings['configuration-directory'] |