Browse Source

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
tags/0.4.7
Fabio Verboso 7 months ago
parent
commit
175653d8aa
1 changed files with 10 additions and 6 deletions
  1. 10
    6
      iotronic/conductor/endpoints.py

+ 10
- 6
iotronic/conductor/endpoints.py View File

@@ -130,12 +130,6 @@ class ConductorEndpoint(object):
130 130
             LOG.error(msg)
131 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 133
         try:
140 134
             old_ses = objects.SessionWP(ctx)
141 135
             old_ses = old_ses.get_session_by_board_uuid(ctx, board.uuid,
@@ -152,6 +146,16 @@ class ConductorEndpoint(object):
152 146
         session = objects.SessionWP(ctx, **session_data)
153 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 159
         board.agent = get_best_agent(ctx)
156 160
         agent = objects.WampAgent.get_by_hostname(ctx, board.agent)
157 161
 

Loading…
Cancel
Save