jazzband / django-dbbackup

Management commands to help backup and restore your project database and media files
BSD 3-Clause "New" or "Revised" License
971 stars 221 forks source link

TypeError: __init__() got an unexpected keyword argument 'access_key' #406

Open RogueOverride opened 2 years ago

RogueOverride commented 2 years ago

Bug Report

Describe the bug

When trying to use Amazon S3 storage back end for storing the backups, I get an error saying 'access_key' is an unexpected argument. I am following accordingly to the documentation.

To Reproduce

DBBACKUP_STORAGE = "storages.backends.s3boto3.S3Boto3Storage"
DBBACKUP_STORAGE_OPTIONS = {
    'access_key': 'my-access-key',
    'secret_key': 'my-secret-key',
    'bucket_name': 'my-bucket-name',
    'default_acl': 'private',
    'location': "database/"
}

After performing the command to create a backup I get the following:

/opt/project/src # python manage.py dbbackup
TypeError: __init__() got an unexpected keyword argument 'access_key'
  File "/usr/local/lib/python3.8/site-packages/dbbackup/utils.py", line 118, in wrapper
    func(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/dbbackup/management/commands/dbbackup.py", line 52, in handle
    self.storage = get_storage()
  File "/usr/local/lib/python3.8/site-packages/dbbackup/storage.py", line 30, in get_storage
    return Storage(path, **options)
  File "/usr/local/lib/python3.8/site-packages/dbbackup/storage.py", line 67, in __init__
    self.storage = self.storageCls(**options)

Traceback (most recent call last):
  File "manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 364, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.8/site-packages/dbbackup/utils.py", line 118, in wrapper
    func(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/dbbackup/management/commands/dbbackup.py", line 52, in handle
    self.storage = get_storage()
  File "/usr/local/lib/python3.8/site-packages/dbbackup/storage.py", line 30, in get_storage
    return Storage(path, **options)
  File "/usr/local/lib/python3.8/site-packages/dbbackup/storage.py", line 67, in __init__
    self.storage = self.storageCls(**options)
TypeError: __init__() got an unexpected keyword argument 'access_key'

Expected behavior

I expected it to act much like sending the file to a local file system location:

/opt/project/src # python manage.py dbbackup
Backing Up Database: dbname
Writing file to database_2021-11-30-213631.sql

Versions

External tools

johnthagen commented 2 years ago

Please try the 4.0.0b0 build (#415) and report if this issue still occurs.