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:
parent
6f3257191f
commit
175653d8aa
|
@ -130,12 +130,6 @@ class ConductorEndpoint(object):
|
||||||
LOG.error(msg)
|
LOG.error(msg)
|
||||||
return wm.WampError(msg).serialize()
|
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:
|
try:
|
||||||
old_ses = objects.SessionWP(ctx)
|
old_ses = objects.SessionWP(ctx)
|
||||||
old_ses = old_ses.get_session_by_board_uuid(ctx, board.uuid,
|
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 = objects.SessionWP(ctx, **session_data)
|
||||||
session.create()
|
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)
|
board.agent = get_best_agent(ctx)
|
||||||
agent = objects.WampAgent.get_by_hostname(ctx, board.agent)
|
agent = objects.WampAgent.get_by_hostname(ctx, board.agent)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue