From e022257721f5f9373e9df813e320af0b9ec474f0 Mon Sep 17 00:00:00 2001 From: dberenguer Date: Mon, 4 Jan 2016 13:57:12 +0100 Subject: [PATCH] MQTT control commands fixed --- lagarto/lagarto-swap/swapmanager.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lagarto/lagarto-swap/swapmanager.py b/lagarto/lagarto-swap/swapmanager.py index 0b3e667..18f71d8 100644 --- a/lagarto/lagarto-swap/swapmanager.py +++ b/lagarto/lagarto-swap/swapmanager.py @@ -2,7 +2,7 @@ # # SwapManager # -# Copyright (c) 2012 Daniel Berenguer +# Copyright (c) 2016 Daniel Berenguer # # This file is part of the lagarto project. # @@ -153,6 +153,12 @@ def get_status(self, endpoints): status.append(endp.dumps()) else: for item in endpoints: + if "id" not in item: + item["id"] = None + if "location" not in item: + item["location"] = None + if "name" not in item: + item["name"] = None endp = self.get_endpoint(item["id"], item["location"], item["name"]) if endp is not None: status.append(endp.dumps()) @@ -171,6 +177,11 @@ def set_status(self, endpoints): """ status = [] for item in endpoints: + if "id" not in item: + item["id"] = None + elif "location" not in item or "name" not in item: + item["location"] = None + item["name"] = None endp = self.get_endpoint(item["id"], item["location"], item["name"]) if endp is not None: if "value" in item: