def update(self, soup, email): current_app.logger.info(f'attempting to update a zayo ticket') match = re.search('TTN-\d+', email['Subject']) if not match: current_app.logger.info(f'could not find an RE match - skipping') return ticket = match.group() maint = Maintenance.query.filter_by(provider_maintenance_id=ticket, rescheduled=0).all() if maint: assert len(maint) == 1, 'More than one maint returned!' maint = maint[0] u = MaintUpdate(maintenance_id=maint.id, comment=self.clean_line(soup.text), updated=datetime.datetime.now()) self.add_and_commit(u) current_app.logger.info(f'maintenance updated') return True return False
def update(self, soup, email): maint_id = self.get_maint_id(email) if not maint_id: return False maint = Maintenance.query.filter_by( provider_maintenance_id=maint_id, rescheduled=0 ).first() if not maint: return False update_text = soup.text if not update_text: for payload in email.get_payload(): update_text = payload.get_payload() u = MaintUpdate( maintenance_id=maint.id, comment=soup.text, updated=datetime.datetime.now() ) self.add_and_commit(u) return True
def update(self, soup, email): match = re.search('TTN-\d+', email['Subject']) if not match: return ticket = match.group() maint = Maintenance.query.filter_by( provider_maintenance_id=ticket, rescheduled=0 ).all() if maint: assert len(maint) == 1, 'More than one maint returned!' maint = maint[0] u = MaintUpdate( maintenance_id=maint.id, comment=soup.text, updated=datetime.datetime.now(), ) self.add_and_commit(u) return True return False
def update(self, email, cal): maint = Maintenance.query.filter_by( provider_maintenance_id=cal['X-MAINTNOTE-MAINTENANCE-ID'], rescheduled=0).first() if not maint: return False u = MaintUpdate( maintenance_id=maint.id, comment=cal['DESCRIPTION'], updated=datetime.datetime.now(), ) self.add_and_commit(u) return True
def update(self, email, cal): current_app.logger.info(f'attempting to update maintenance') maint = Maintenance.query.filter_by( provider_maintenance_id=cal['X-MAINTNOTE-MAINTENANCE-ID'], rescheduled=0).first() if not maint: return False u = MaintUpdate(maintenance_id=maint.id, comment=cal['DESCRIPTION'], updated=datetime.datetime.now()) self.add_and_commit(u) current_app.logger.info(f'maintenance {maint.provider_maintenance_id} updated successfully') return True