Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supervisor update 2022.07.0 has removed deprecated 'hassio/snapshots' #67

Open
ResteNarquois opened this issue Jul 8, 2022 · 10 comments

Comments

@ResteNarquois
Copy link

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

@d0ugal
Copy link
Owner

d0ugal commented Jul 8, 2022

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'

hassio.hassio_post(f"snapshots/{snapshot['slug']}/remove")

@EspressoNerd
Copy link

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

@d0ugal
Copy link
Owner

d0ugal commented Jul 11, 2022

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

@IanAdd
Copy link

IanAdd commented Jul 20, 2022

me too, hope you find the time.

@non092
Copy link

non092 commented Aug 14, 2022

@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

@EtienneMD
Copy link
Contributor

EtienneMD commented Sep 15, 2022

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.

@d0ugal
Copy link
Owner

d0ugal commented Sep 15, 2022

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

@EtienneMD
Copy link
Contributor

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
Copy link
Contributor

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

@non092
Copy link

non092 commented Sep 26, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants