summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2014-04-22 14:45:42 +0000
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2014-04-22 14:45:42 +0000
commitad86d0823eca54c475a33c77fd7f8e833717fb97 (patch)
tree97f6ae2c74adc8e699a8305faa5bbb36963a7425
parentfa53202db029c6cef266c40e8be5fde17b60af91 (diff)
downloadlorry-controller-ad86d0823eca54c475a33c77fd7f8e833717fb97.tar.gz
Rename variables for clarity
-rw-r--r--lorrycontroller/readconf.py19
1 files changed, 9 insertions, 10 deletions
diff --git a/lorrycontroller/readconf.py b/lorrycontroller/readconf.py
index b6f7333..4a193b1 100644
--- a/lorrycontroller/readconf.py
+++ b/lorrycontroller/readconf.py
@@ -59,8 +59,8 @@ class ReadConfiguration(lorrycontroller.LorryControllerRoute):
statedb = self.open_statedb()
with statedb:
- existing_lorries = set(statedb.get_lorries_paths())
- existing_troves = set(statedb.get_troves())
+ lorries_to_remove = set(statedb.get_lorries_paths())
+ troves_to_remove = set(statedb.get_troves())
for section in conf_obj:
if not 'type' in section:
@@ -68,13 +68,13 @@ class ReadConfiguration(lorrycontroller.LorryControllerRoute):
if section['type'] == 'lorries':
added = self.add_matching_lorries_to_statedb(
statedb, section)
- existing_lorries = existing_lorries.difference(added)
+ lorries_to_remove = lorries_to_remove.difference(added)
elif section['type'] in ('trove', 'troves'):
self.add_trove(statedb, section)
- if section['trovehost'] in existing_troves:
- existing_troves.remove(section['trovehost'])
- existing_lorries = self.without_lorries_for_trovehost(
- statedb, existing_lorries, section['trovehost'])
+ 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'])
else:
logging.error(
'Unknown section in configuration: %r', section)
@@ -82,14 +82,13 @@ class ReadConfiguration(lorrycontroller.LorryControllerRoute):
'ERROR: Unknown section type in configuration: %r' %
section)
- for path in existing_lorries:
+ for path in lorries_to_remove:
statedb.remove_lorry(path)
- for trovehost in existing_troves:
+ for trovehost in troves_to_remove:
statedb.remove_trove(trovehost)
statedb.remove_lorries_for_trovehost(trovehost)
-
if 'redirect' in bottle.request.forms:
bottle.redirect(bottle.request.forms.redirect)