+
Skip to content

Database push fails when in a subdirectory #234

@petrklus

Description

@petrklus

When running the command to push database contents to the Divio platform inside below the project root, the command fails with:

FileNotFoundError: [Errno 2] No such file or directory: 'local_db.sql'

Full error output:

$ divio project push db --remote-id=CENSORED
New version 3.7 is available. Type `divio version` to show information about upgrading.
WARNING
=======

You are about to push your local database to the test server on 
the Divio Cloud. This will replace ALL data on the Divio Cloud test 
server with the data you are about to push, including (but not limited to):
  - User accounts
  - CMS Pages & Plugins

You will also lose any changes that have been made on the test 
server since you pulled its database to your local environment. 

It is recommended to go the project settings on control.divio.com
and take a backup before restoring the database. You can find this 
action in the "Manage Project" section.

Please proceed with caution!

Are you sure you want to continue? [y/N]: y
 ===> Pushing local database to Project CENSORED test server
 ---> Starting local database server
      CENSORED is up-to-date
      [0s]
 ---> Dumping local database [84s]
Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/bin/divio", line 11, in <module>
    load_entry_point('divio-cli==3.5.0', 'console_scripts', 'divio')()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/divio_cli/localdev/utils.py", line 207, in read_remote_id
    return func(remote_id, *args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/click/decorators.py", line 27, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/divio_cli/cli.py", line 483, in push_db
    localdev.push_db(obj.client, stage=stage, remote_id=remote_id)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/divio_cli/localdev/main.py", line 698, in push_db
    dump_filename=dump_filename, archive_filename=archive_filename
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/divio_cli/localdev/main.py", line 620, in dump_database
    sql_dump_size = os.path.getsize(dump_filename)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/genericpath.py", line 50, in getsize
    return os.stat(filename).st_size
FileNotFoundError: [Errno 2] No such file or directory: 'local_db.sql'

Re-running the command at the project root works fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载