diff options
-rw-r--r-- | lorrycontroller/readconf.py | 5 | ||||
-rw-r--r-- | yarns.webapp/060-validation.yarn | 8 |
2 files changed, 12 insertions, 1 deletions
diff --git a/lorrycontroller/readconf.py b/lorrycontroller/readconf.py index b0124a9..64599e4 100644 --- a/lorrycontroller/readconf.py +++ b/lorrycontroller/readconf.py @@ -69,8 +69,11 @@ class ReadConfiguration(lorrycontroller.LorryControllerRoute): existing_lorries = self.without_lorries_for_trovehost( statedb, existing_lorries, section['trovehost']) else: - logging.warning( + logging.error( 'Unknown section in configuration: %r', section) + return ( + 'ERROR: Unknown section type in configuration: %r' % + section) for path in existing_lorries: statedb.remove_lorry(path) diff --git a/yarns.webapp/060-validation.yarn b/yarns.webapp/060-validation.yarn index 508f1f2..b7b1a66 100644 --- a/yarns.webapp/060-validation.yarn +++ b/yarns.webapp/060-validation.yarn @@ -75,6 +75,14 @@ an artifact of how yarn steps are implemented and is OK. THEN response matches "ERROR" AND STATEDB is empty +What about a section that has a `type` field, but it's set to a +non-sensical value? + + GIVEN a lorry-controller.conf in CONFGIT containing "[{"type": "BACKUPS!"}]" + WHEN admin makes request POST /1.0/read-configuration with dummy=value + THEN response matches "ERROR" + AND STATEDB is empty + Clean up at the end. FINALLY WEBAPP terminates |