Wamp registration rpc returns the configuration.

if the board is already registered the wamp rpc returns
the board config instead of rejects the request,

Change-Id: Id23f558d7598d44d69effc929d07bdc25ae90e45
This commit is contained in:
Fabio Verboso 2019-02-05 11:03:22 +01:00
parent 6f3257191f
commit 175653d8aa
1 changed files with 10 additions and 6 deletions

View File

@ -130,12 +130,6 @@ class ConductorEndpoint(object):
LOG.error(msg)
return wm.WampError(msg).serialize()
if not board.status == states.REGISTERED:
msg = "board with code %(board)s cannot " \
"be registered again." % {'board': code}
LOG.error(msg)
return wm.WampError(msg).serialize()
try:
old_ses = objects.SessionWP(ctx)
old_ses = old_ses.get_session_by_board_uuid(ctx, board.uuid,
@ -152,6 +146,16 @@ class ConductorEndpoint(object):
session = objects.SessionWP(ctx, **session_data)
session.create()
if not board.status == states.REGISTERED:
msg = "board with code %(board)s " \
"already registered" % {'board': code}
LOG.warning((msg))
board.status = states.OFFLINE
board.save()
LOG.debug('sending this conf %s', board.config)
wmessage = wm.WampSuccess(board.config)
return wmessage.serialize()
board.agent = get_best_agent(ctx)
agent = objects.WampAgent.get_by_hostname(ctx, board.agent)