Revision 05146623 snf-cyclades-app/synnefo/logic/backend.py
b/snf-cyclades-app/synnefo/logic/backend.py | ||
---|---|---|
30 | 30 |
# documentation are those of the authors and should not be |
31 | 31 |
# interpreted as representing official policies, either expressed |
32 | 32 |
# or implied, of GRNET S.A. |
33 |
|
|
34 |
import json |
|
35 |
|
|
36 | 33 |
from django.conf import settings |
37 | 34 |
from django.db import transaction |
38 | 35 |
from datetime import datetime |
... | ... | |
223 | 220 |
back_network.backendopcode = opcode |
224 | 221 |
back_network.backendlogmsg = logmsg |
225 | 222 |
|
223 |
network = back_network.network |
|
224 |
|
|
226 | 225 |
# Notifications of success change the operating state |
227 | 226 |
state_for_success = BackendNetwork.OPER_STATE_FROM_OPCODE.get(opcode, None) |
228 | 227 |
if status == 'success' and state_for_success is not None: |
... | ... | |
233 | 232 |
back_network.backendtime = etime |
234 | 233 |
|
235 | 234 |
if opcode == 'OP_NETWORK_REMOVE': |
236 |
if status == 'success' or (status == 'error' and |
|
237 |
back_network.operstate == 'ERROR'): |
|
235 |
if (status == 'success' or |
|
236 |
(status == 'error' and (back_network.operstate == 'ERROR' or |
|
237 |
network.action == 'DESTROY'))): |
|
238 | 238 |
back_network.operstate = state_for_success |
239 | 239 |
back_network.deleted = True |
240 | 240 |
back_network.backendtime = etime |
... | ... | |
243 | 243 |
back_network.backendtime = etime |
244 | 244 |
back_network.save() |
245 | 245 |
# Also you must update the state of the Network!! |
246 |
update_network_state(back_network.network)
|
|
246 |
update_network_state(network) |
|
247 | 247 |
|
248 | 248 |
|
249 | 249 |
def update_network_state(network): |
Also available in: Unified diff