Use account_id instead of access_key for bucket names and trim it trim to 50
This commit is contained in:
parent
4cbaf0c52f
commit
5461dec55c
3 changed files with 4 additions and 2 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -2,3 +2,5 @@
|
||||||
/secrets.py
|
/secrets.py
|
||||||
*.pyc
|
*.pyc
|
||||||
/.venv/
|
/.venv/
|
||||||
|
/venv/
|
||||||
|
/test.py
|
||||||
|
|
2
BackupPC_archiveHost_b2.py
Executable file → Normal file
2
BackupPC_archiveHost_b2.py
Executable file → Normal file
|
@ -212,7 +212,7 @@ def open_b2(access_key: str, shared_key: str, host: str) -> Bucket:
|
||||||
:return: The host B2 bucket
|
:return: The host B2 bucket
|
||||||
"""
|
"""
|
||||||
b2_api.authorize_account("production", access_key, shared_key)
|
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 = [{
|
lifecycle_rules = [{
|
||||||
'daysFromHidingToDeleting': 1,
|
'daysFromHidingToDeleting': 1,
|
||||||
'daysFromUploadingToHiding': None,
|
'daysFromUploadingToHiding': None,
|
||||||
|
|
|
@ -51,7 +51,7 @@ class BackupManager:
|
||||||
self._backups = None
|
self._backups = None
|
||||||
|
|
||||||
def _generate_backup_buckets(self) -> [Bucket]:
|
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()
|
buckets = self._connection.list_buckets()
|
||||||
self._buckets = []
|
self._buckets = []
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue