blob: bfe7995bac31f8df363599c5f1d2afe93235f43d [file] [log] [blame]
Scott Bakerb63ea792016-08-11 10:24:48 -07001def handle(controller_slice):
2 from core.models import ControllerSlice, Slice
3
4 try:
5 my_status_code = int(controller_slice.backend_status[0])
6 try:
7 his_status_code = int(controller_slice.slice.backend_status[0])
8 except:
9 his_status_code = 0
10
11 fields = []
12 if (my_status_code not in [0,his_status_code]):
13 controller_slice.slice.backend_status = controller_slice.backend_status
14 fields+=['backend_status']
15
16 if (controller_slice.backend_register != controller_slice.slice.backend_register):
17 controller_slice.slice.backend_register = controller_slice.backend_register
18 fields+=['backend_register']
19
20 controller_slice.slice.save(update_fields = fields)
21
22
23 except Exception,e:
24 print str(e)
25 pass