summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Verboso <fverboso@unime.it>2019-02-05 11:03:22 +0100
committerFabio Verboso <fverboso@unime.it>2019-02-05 11:05:54 +0100
commit175653d8aa6327c12b1d4622ceec1de04e28f222 (patch)
tree7f1c40207d62fd5f2e3ffeb12c4c0d2f2903a70a
parent6f3257191f16fda530e963c4b8b4e2a42f5555fe (diff)
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
Notes
Notes (review): Code-Review+2: Fabio Verboso <fverboso@unime.it> Workflow+1: Fabio Verboso <fverboso@unime.it> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Tue, 05 Feb 2019 10:24:36 +0000 Reviewed-on: https://review.openstack.org/634896 Project: openstack/iotronic Branch: refs/heads/master
-rw-r--r--iotronic/conductor/endpoints.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/iotronic/conductor/endpoints.py b/iotronic/conductor/endpoints.py
index b30258d..01bf11c 100644
--- a/iotronic/conductor/endpoints.py
+++ b/iotronic/conductor/endpoints.py
@@ -130,12 +130,6 @@ class ConductorEndpoint(object):
130 LOG.error(msg) 130 LOG.error(msg)
131 return wm.WampError(msg).serialize() 131 return wm.WampError(msg).serialize()
132 132
133 if not board.status == states.REGISTERED:
134 msg = "board with code %(board)s cannot " \
135 "be registered again." % {'board': code}
136 LOG.error(msg)
137 return wm.WampError(msg).serialize()
138
139 try: 133 try:
140 old_ses = objects.SessionWP(ctx) 134 old_ses = objects.SessionWP(ctx)
141 old_ses = old_ses.get_session_by_board_uuid(ctx, board.uuid, 135 old_ses = old_ses.get_session_by_board_uuid(ctx, board.uuid,
@@ -152,6 +146,16 @@ class ConductorEndpoint(object):
152 session = objects.SessionWP(ctx, **session_data) 146 session = objects.SessionWP(ctx, **session_data)
153 session.create() 147 session.create()
154 148
149 if not board.status == states.REGISTERED:
150 msg = "board with code %(board)s " \
151 "already registered" % {'board': code}
152 LOG.warning((msg))
153 board.status = states.OFFLINE
154 board.save()
155 LOG.debug('sending this conf %s', board.config)
156 wmessage = wm.WampSuccess(board.config)
157 return wmessage.serialize()
158
155 board.agent = get_best_agent(ctx) 159 board.agent = get_best_agent(ctx)
156 agent = objects.WampAgent.get_by_hostname(ctx, board.agent) 160 agent = objects.WampAgent.get_by_hostname(ctx, board.agent)
157 161