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

-O flag does not respect S3 URIs #537

Open
WillNilges opened this issue Nov 2, 2024 · 0 comments
Open

-O flag does not respect S3 URIs #537

WillNilges opened this issue Nov 2, 2024 · 0 comments
Labels
bug Bugs that need to get fixed.

Comments

@WillNilges
Copy link

Current Situation

I have a Django project with dbbackup backed by S3. This is configured in my settings.py. When I am trying to do one-off backups, I want to run the command python manage.py dbbackup -O s3://meshdb-backups/dev/. However, I am getting an exception when I try to run that command:

INFO:dbbackup.command:Writing file to s3://meshdb-data-backups/meshdb-backups/dev/
ERROR:dbbackup:FileNotFoundError: [Errno 2] No such file or directory: 's3://meshdb-data-backups/meshdb-backups/dev/'
  File "/usr/local/lib/python3.11/site-packages/dbbackup/utils.py", line 116, in wrapper
    func(*args, **kwargs)
  File "/usr/local/lib/python3.11/site-packages/dbbackup/management/commands/dbbackup.py", line 100, in handle
    self._save_new_backup(database)
  File "/usr/local/lib/python3.11/site-packages/dbbackup/management/commands/dbbackup.py", line 142, in _save_new_backup
    self.write_local_file(outputfile, self.path)
  File "/usr/local/lib/python3.11/site-packages/dbbackup/management/commands/_base.py", line 108, in write_local_file
    with open(path, "wb") as fd:
         ^^^^^^^^^^^^^^^^
  File "/datadog-lib/ddtrace_pkgs/site-packages-ddtrace-py3.11-manylinux2014/ddtrace/appsec/_common_module_patches.py", line 85, in wrapped_open_CFDDB7ABBA9081B6
    raise e.with_traceback(
  File "/usr/local/lib/python3.11/site-packages/dbbackup/management/commands/_base.py", line 108, in write_local_file
    with open(path, "wb") as fd:
         ^^^^^^^^^^^^^^^^

Traceback (most recent call last):
  File "/opt/meshdb/manage.py", line 26, in <module>
    main()
  File "/opt/meshdb/manage.py", line 22, in main
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.11/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.11/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.11/site-packages/django/core/management/base.py", line 412, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.11/site-packages/django/core/management/base.py", line 458, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/dbbackup/utils.py", line 116, in wrapper
    func(*args, **kwargs)
  File "/usr/local/lib/python3.11/site-packages/dbbackup/management/commands/dbbackup.py", line 100, in handle
    self._save_new_backup(database)
  File "/usr/local/lib/python3.11/site-packages/dbbackup/management/commands/dbbackup.py", line 142, in _save_new_backup
    self.write_local_file(outputfile, self.path)
  File "/usr/local/lib/python3.11/site-packages/dbbackup/management/commands/_base.py", line 108, in write_local_file
    with open(path, "wb") as fd:
         ^^^^^^^^^^^^^^^^
  File "/datadog-lib/ddtrace_pkgs/site-packages-ddtrace-py3.11-manylinux2014/ddtrace/appsec/_common_module_patches.py", line 85, in wrapped_open_CFDDB7ABBA9081B6
    raise e.with_traceback(
  File "/usr/local/lib/python3.11/site-packages/dbbackup/management/commands/_base.py", line 108, in write_local_file
    with open(path, "wb") as fd:
         ^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 's3://meshdb-data-backups/meshdb-backups/dev/'

Proposed Actions

Ensure that the -O flag understands S3.

System Information

DBBackup version: 3ccac96

Django: "django==4.2.*",

Python: python:3.11-bookworm

@WillNilges WillNilges added the bug Bugs that need to get fixed. label Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bugs that need to get fixed.
Projects
None yet
Development

No branches or pull requests

1 participant