Board configuration shown

The configuration of the board is shown when you get its info using the rest api.

Change-Id: I942957fb4ee856fd9fd9539511c32a07c176afc9
This commit is contained in:
Fabio Verboso 2020-04-17 11:17:27 +02:00
parent 4bdaa441c1
commit a71417de71

View File

@ -63,6 +63,7 @@ class Board(base.APIBase):
links = wsme.wsattr([link.Link], readonly=True)
location = wsme.wsattr([loc.Location])
extra = types.jsontype
config = types.jsontype
def __init__(self, **kwargs):
self.fields = []
@ -120,6 +121,23 @@ class Board(base.APIBase):
# if fields is not None:
# api_utils.check_for_invalid_fields(fields, board_dict)
if board.config == {}:
ragent = objects.WampAgent.get_registration_agent(
pecan.request.context)
board.config = {
"iotronic": {
"board": {
"code": board.code
},
"wamp": {
"registration-agent": {
"url": ragent.wsurl,
"realm": "s4t"
}
}
}
}
return cls._convert_with_links(board,
pecan.request.public_url,
fields=fields)