hassio-dropbox-upload icon indicating copy to clipboard operation
hassio-dropbox-upload copied to clipboard

Supervisor update 2022.07.0 has removed deprecated 'hassio/snapshots'

Open ResteNarquois opened this issue 2 years ago • 10 comments

The changes to Supervisor outlined here, especially the name change from 'snapshot' to 'backup', seem to have finally broken this addon with Supervisor 2022.07.0.

The following error in logs seems to show the addon looking at the wrong endpoint for existing backups via the API:

2022-07-08 12:26:26,353 - ERROR - Unhandled error Traceback (most recent call last): File "/app/dropbox_upload/__main__.py", line 41, in main snapshots = hassio.list_snapshots() File "/app/dropbox_upload/hassio.py", line 30, in list_snapshots snapshots = hassio_get("snapshots")["snapshots"] File "/app/dropbox_upload/hassio.py", line 22, in hassio_get return hassio_req(requests.get, path) File "/app/dropbox_upload/hassio.py", line 15, in hassio_req r.raise_for_status() File "/usr/lib/python3.8/site-packages/requests/models.py", line 941, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://hassio/snapshots

Not sure if it's as simple as replacing every occurrence in the code of 'snapshot' with 'backup'?

I think this note may also apply:

To delete a snapshot you now have to use the DELETE HTTP method with the /backups endpoint, previously both POST and DELETE were supported

ResteNarquois avatar Jul 08 '22 11:07 ResteNarquois

Thanks for the report. I was sort-of aware this was going to happen at some point.

I'm not sure when I'll have the capacity to try and fix this but I do think the fix should be fairly simple.

Looks like you are correct about the delete. That should also be an easy fix tho'

https://github.com/d0ugal/hassio-dropbox-upload/blob/c024b546ef6ca3bb1a87d245c0f6bfabbd7d6cb8/dropbox-upload/dropbox_upload/limit.py#L33

d0ugal avatar Jul 08 '22 12:07 d0ugal

I am having the same issue and would appreciate a solution.

EspressoNerd avatar Jul 11 '22 11:07 EspressoNerd

I've stopped using this project, it was only a small part of my backup strategy. I'd be happy to accept contributions or add maintainers if anyone else would like to work on it.

I may get around to fixing it at some point but this is very much a volunteer effort from me. I don't think I will come back to it

d0ugal avatar Jul 11 '22 18:07 d0ugal

me too, hope you find the time.

IanAdd avatar Jul 20 '22 19:07 IanAdd

@d0ugal I fixed the code to use the new backup endpoint and change to delete operation I had to do some other changes so the add-on works properly when building with latest images Changes can be see in my fork

However for some reason the add-on cannot read the env for the SUPERVISOR_TOKEN anymore this is the log when starting the add-on : 2022-08-14 09:55:53,612 - INFO - Starting Snapshot backup 2022-08-14 09:55:53,614 - DEBUG - Auth headers: {'Authorization': 'Bearer None'} 2022-08-14 09:55:53,628 - DEBUG - <Response [403]> 2022-08-14 09:55:53,629 - ERROR - Unhandled error Traceback (most recent call last): File "/app/dropbox_upload/__main__.py", line 41, in main snapshots = hassio.list_snapshots() File "/app/dropbox_upload/hassio.py", line 37, in list_snapshots snapshots = hassio_get("backups")["backups"] File "/app/dropbox_upload/hassio.py", line 27, in hassio_get return hassio_req(requests.get, path) File "/app/dropbox_upload/hassio.py", line 20, in hassio_req r.raise_for_status() File "/usr/lib/python3.10/site-packages/requests/models.py", line 941, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: http://supervisor/backups

I can't figure out why and if I run "python3 -m dropbox_upload" manually in the container it works just fine If you have any clue what's happening here we are close of having this fixed and I can raise a PR when fully working

non092 avatar Aug 14 '22 09:08 non092

It's because of the S6 overlay. See documentation here, under Container environment. I tried and it did fix the issue with your fork for me.

EtienneMD avatar Sep 15 '22 18:09 EtienneMD

Nice one. If you can get things working and you’d like to have write access to this repo let me know. Happy to have more maintainers if it helps unblock you all

d0ugal avatar Sep 15 '22 18:09 d0ugal

Happy to create a PR, but really non092 did all the work here. I am just an enthusiast, not a developer, so I'd rather not get too involved with maintenance in case I accidentally mess things up.

EtienneMD avatar Sep 15 '22 19:09 EtienneMD

I've reworked the Dockerfile and reduced the size of the image by about 15% will submit a PR shortly.

EtienneMD avatar Sep 16 '22 13:09 EtienneMD

Sorry I had no time going back to this and in the meantime I switched to doing my backups to Google Drive I'm sure I read about the S6 overlay stuff but somehow didn't think about implementing it ..

Glad @EtienneMD figured it out !

Just to note I only made changes required to make the plugin work properly again, it would be a good idea to change all reference to change all references to "snapshot" to "backup" in the code for clarity

non092 avatar Sep 26 '22 17:09 non092