Skip to content

Commit

Permalink
MQTT control commands fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
dberenguer committed Jan 4, 2016
1 parent d1c8faa commit e022257
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lagarto/lagarto-swap/swapmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SwapManager
#
# Copyright (c) 2012 Daniel Berenguer <[email protected]>
# Copyright (c) 2016 Daniel Berenguer <[email protected]>
#
# This file is part of the lagarto project.
#
Expand Down Expand Up @@ -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())
Expand All @@ -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:
Expand Down

0 comments on commit e022257

Please sign in to comment.