Example #1
0
 def import_changes(self):
     device_type = ContentType.objects.get(
         app_label="discovery", model="device")
     for x in HistoryChange.objects.filter(user_id__gt=0, device__gt=0):
         try:
             ch = db.CIChange()
             ch.content_object = x
             try:
                 ci = db.CI.objects.get(
                     object_id=x.device.id, content_type=device_type)
             except db.CI.DoesNotExist:
                 continue
             ch.ci = ci
             ch.priority = db.CI_CHANGE_PRIORITY_TYPES.WARNING.id
             ch.time = x.date
             ch.message = x.comment or ''
             ch.type = db.CI_CHANGE_TYPES.DEVICE.id
             if x.user_id:
                 ch.registration_type = chdb.CI_CHANGE_REGISTRATION_TYPES.WAITING.id
             ch.save()
             register_issue_signal.send(sender=self, change_id=ch.id)
         except IntegrityError:
             logger.debug('Skipping already imported: %s' % x)
Example #2
0
 def handle(self, *args, **options):
     logger.debug('Syncing tickets.')
     for change in chdb.CIChange.objects.filter(
             registration_type=chdb.CI_CHANGE_REGISTRATION_TYPES.WAITING):
         register_issue_signal.send(sender=self, change_id=change.id)
     logger.debug('Finished syncing tickets.')
Example #3
0
 def handle(self, *args, **options):
     logger.debug('Syncing tickets.')
     for change in chdb.CIChange.objects.filter(
             registration_type=chdb.CI_CHANGE_REGISTRATION_TYPES.WAITING):
         register_issue_signal.send(sender=self, change_id=change.id)
     logger.debug('Finished syncing tickets.')