Use account_id instead of access_key for bucket names and trim it trim to 50

This commit is contained in:
Ethanell 2022-10-19 13:35:36 +02:00
parent 4cbaf0c52f
commit 5461dec55c
3 changed files with 4 additions and 2 deletions

2
.gitignore vendored
View file

@ -2,3 +2,5 @@
/secrets.py
*.pyc
/.venv/
/venv/
/test.py

2
BackupPC_archiveHost_b2.py Executable file → Normal file
View file

@ -212,7 +212,7 @@ def open_b2(access_key: str, shared_key: str, host: str) -> Bucket:
:return: The host B2 bucket
"""
b2_api.authorize_account("production", access_key, shared_key)
my_bucket_name = f"{access_key}-bckpc-{host.replace('.', '-')}".lower()
my_bucket_name = f"{b2_api.account_info._account_id}-bckpc-{host.replace('.', '-')}".lower()[:50]
lifecycle_rules = [{
'daysFromHidingToDeleting': 1,
'daysFromUploadingToHiding': None,

View file

@ -51,7 +51,7 @@ class BackupManager:
self._backups = None
def _generate_backup_buckets(self) -> [Bucket]:
bucket_prefix = f"{self._access_key}-bckpc-".lower()
bucket_prefix = f"{self._connection.account_info._account_id}-bckpc-".lower()
buckets = self._connection.list_buckets()
self._buckets = []