Exemple #1
0
 def run(self, device=None):
     """Send an e-mail to the device assignee and remove reminder."""
     if not device:
         raise base_action.MissingDeviceError(
             'Cannot send mail. Task did not receive a device.')
     if not hasattr(device, 'next_reminder') or not device.next_reminder:
         raise base_action.BadDeviceError(
             'Cannot send mail without next_reminder on device with serial '
             '{}.'.format(device.serial_number))
     reminder_event = event_models.ReminderEvent.get(
         device.next_reminder.level)
     if not reminder_event:
         raise base_action.BadDeviceError(
             'Cannot send mail. There is no ReminderEvent entity for level '
             '{}.'.format(device.next_reminder.level))
     logging.info('Sending reminder at level %d to device %s.',
                  device.next_reminder.level, device.identifier)
     send_email.send_user_email(device, reminder_event.template)
     device.set_last_reminder(device.next_reminder.level)
     device.next_reminder = None
     device.put()
Exemple #2
0
 def run(self, device=None):
     """Sends an e-mail to a new device assignee."""
     if not device:
         raise base_action.MissingDeviceError(
             'Cannot send mail. Task did not receive a device.')
     send_email.send_user_email(device, 'reminder_welcome')
Exemple #3
0
 def run(self, device=None):
     """Lock a device."""
     if not device:
         raise base_action.MissingDeviceError(
             'Cannot lock device. Task did not receive a device.')
     device.lock(constants.ADMIN_USERNAME)
Exemple #4
0
 def run(self, device=None):
     """Sends an e-mail to a former device assignee, thanking them."""
     if not device:
         raise base_action.MissingDeviceError(
             'Cannot send mail. Task did not receive a device.')
     send_email.send_user_email(device, 'reminder_return_thanks', False)