-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
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
Add S3 Bucket integration for backups #134206
base: dev
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
raise ConfigEntryAuthFailed( | ||
f"Invalid authentication token for S3 account: {err}" | ||
) from err | ||
except Exception as err: # noqa: BLE001 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't catch all exceptions. Always limit it to errors you expect it to be raised
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HI Paulus! Thank you for reviewing and taking your time. I am new in homeassistant and perhaps would need a little more help. But I am eager to learn. This is the list of exceptions botocore could raise:
https://boto3.amazonaws.com/v1/documentation/api/latest/guide/error-handling.html#botocore-exceptions
I can not see in the documentation of session.client which exceptions it could raise. I browsed through the code and I think that could be a lot. Many should be covered by ClientError. But how should I take care for the Exceptions I am not aware of? I thought the "final" exception is taking care for this. If I would remove it - and an uncatched exceptions is being raised - what happens then? What is your recommendation?
Did you think about using one of the asyncio implementations (aiobotocore/aioboto3)? This can make your code significantly shorter (check my azure_storage PR for a comparison) |
…into s3-backup-location
Hi, yes i tried to use the async libs, but did not succeed. My skills have not been high enough to get this sorted out :( |
Will this addon work for any s3 compatible storage? That would allow a large number of providers out of the box (some are listed below) and eliminate the need for dedicated provider support such as #134085 and #134014. Non exhaustive list of s3 compatible providers:
|
@mbrevda should be the case. Under the hood S3 storage also appeals to a certain group of users. @mkohns do you need an helping hand here? |
imo we should use the async libs (especially if they are already available), because performance will be better |
Breaking change
Proposed change
Inspired by #134014
I added a new integration handling S3 buckets for backup locations.
I tested this with iDrive, Minio and Azure Storage (over S3Proxy)
Type of change
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
.To help with the load of incoming pull requests: