@@ -308,6 +308,8 @@ def get(cls, ci_id, oneagent_id, oneagent_name, last_update_at=None):
308
308
if new_last_update_at < __last_update_at :
309
309
new_last_update_at = __last_update_at
310
310
311
+ new_last_update_at = new_last_update_at or ad_rules_updated_at
312
+
311
313
write_ad_rule_sync_history .apply_async (args = (result , oneagent_id , oneagent_name , datetime .datetime .now ()),
312
314
queue = CMDB_QUEUE )
313
315
if not last_update_at or new_last_update_at > last_update_at :
@@ -693,6 +695,11 @@ def delete2(cls, type_id, unique_value):
693
695
stdout = "delete resource: {}" .format (unique_value ))
694
696
# TODO: delete ci
695
697
698
+ @classmethod
699
+ def get_instance_by_id (cls , adc_id ):
700
+ adc = cls .cls .get_by_id (adc_id ) or abort (404 , ErrFormat .adc_not_found )
701
+ return adc .instance
702
+
696
703
@classmethod
697
704
def accept (cls , adc , adc_id = None , nickname = None ):
698
705
if adc_id is not None :
@@ -725,7 +732,7 @@ def accept(cls, adc, adc_id=None, nickname=None):
725
732
from api .tasks .cmdb import add_net_device_ports
726
733
add_net_device_ports .apply_async (args = (ci_id , adc .instance ['ports' ]),
727
734
queue = CMDB_QUEUE )
728
-
735
+
729
736
adc .update (is_accept = True ,
730
737
accept_by = nickname or current_user .nickname ,
731
738
accept_time = datetime .datetime .now (),
0 commit comments