summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2014-04-22 14:51:18 +0000
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2014-04-22 14:51:18 +0000
commit2bc37426f5caf3a257fa8637f3fd10e60590ddb2 (patch)
tree009c2158fc146f87e3d3b92c45d3451136ee258b
parentad86d0823eca54c475a33c77fd7f8e833717fb97 (diff)
downloadlorry-controller-2bc37426f5caf3a257fa8637f3fd10e60590ddb2.tar.gz
Clarify code by removing confusingly named method
-rw-r--r--lorrycontroller/readconf.py13
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']