ghan1t / udev-trigger-zfs-autobackup

Automatically snapshot and sync ZFS datasets when backup disk is attached.
MIT License
4 stars 1 forks source link

SMTP configuration is not optional #6

Closed 0xabu closed 5 months ago

0xabu commented 5 months ago

config_template.yaml suggests that the use of email is optional:

# Enter an smtp configuration. Remove this config entirely, if you do not want so send mails.

... however, this seems not to be true. I commented out the entire block so there is no smtp node at the top-level. Upon inserting a disk, I get:

Starting the backup now. You will receive an email once the backup has completed and you can safely unplug the disk.
ERROR: An unexpected error occurred: 'NoneType' object has no attribute 'login'
Traceback (most recent call last):
  File "/home/admin/autobackup/monitor.py", line 86, in start_waiting_for_udev_trigger
    import_decrypt_backup_export(device_label, config, logger)
  File "/home/admin/autobackup/backup.py", line 18, in import_decrypt_backup_export
    mail(f"Plugged in disk {device_label} that is matching configuration:\n"+
  File "/home/admin/autobackup/mail_util.py", line 43, in mail
    send_email("ZFS-Autobackup with UDEV Trigger", message, config, logger)
  File "/home/admin/autobackup/mail_util.py", line 22, in send_email
    message['From'] = config.login  # Set email from
                      ^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'login'
ghan1t commented 5 months ago

@0xabu you are right, I planned to have it optional but then never tried without one. Update the script with ./trigger.sh --install and try again. Let me know if you find anything else.