N4S4 / synology-api

A Python wrapper around Synology API
MIT License
400 stars 145 forks source link

gen_list KeyError 'SYNO.Backup.Service.VersionBackup.Target' #182

Closed rienafairefr closed 1 month ago

rienafairefr commented 1 month ago

Describe the bug I was trying to access HyperBackup info through the DSM API, more specifically the prometheus exporter raph2i/synology_backup_exporter, and getting a KeyError exception

  File "***/open-source/synology_backup_exporter/init.py", line 254, in <module>
    hyper_backup_vault_get_info()
  File "***/synology_backup_exporter/init.py", line 171, in hyper_backup_vault_get_info
    hyper_backup_vault_data = hyper_backup_vault_session.vault_target_list()
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "***/.virtualenvs/synology_backup_exporter/lib/python3.11/site-packages/synology_api/core_backup.py", line 74, in vault_target_list
    info = self.gen_list[api_name]
           ~~~~~~~~~~~~~^^^^^^^^^^
KeyError: 'SYNO.Backup.Service.VersionBackup.Target'

I've attached the gen_list from my NAS as received from the API: gen_list.json

I've tested with all the users, a non-admin, user in admin groups, full-admin, with the same result.

The user I'm using doesn't seem to have a problem with accessing the hyperbackup targets or config or whatever in the web-UI.

The hyperbackup has already run before, it's not a first run. Can SYNO.Backup.Service.VersionBackup.Target be a target I'm not using, like to a remote NAS or C2 ? I only have a push to a remote webdav and that's it.

It might be a compatibility problem with the latest update in DSM7 (I haven't tested with the versions before that one, and it's apparently impossible to downgrade)

Running DS220+, with DSM 7.2.1-69057 Update 5

N4S4 commented 1 month ago

hello, I will run a test and see if i encounter same issue

rienafairefr commented 1 month ago

Seems to me I've raised the issue before looking deep enough https://mariushosting.com/synology-hyper-backup-vs-hyper-backup-vault/ There is a difference between these two, and I was not using hyper backup vault. So of course, I shouldn't expect to be able to scrape a metric for it. Once I install the hyperbackupvault package on the NAS, the API becomes available and the code doesn't crash anymore. There is no bug in synology-api, my apologies :-D