Uploaded image for project: 'Nuxeo Drive '
  1. Nuxeo Drive
  2. NXDRIVE-2

Drive: make Alembic database migration work under Linux

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 1.3.0611
    • Fix Version/s: None
    • Component/s: None
    • Backlog priority:
      450

      Description

      For now it is not the case as we don't handle alembic/versions folder as a Python module (should probably do), so Alembic versions don't end up in the nxdrive installed Python packages when installing Drive, typically in /usr/local/lib/python2.7/dist-packages when using pip.

      For OSX and Windows, we explicitely copy these files to a folder in the application bundle when freezing it. Need to find the equivalent for Linux, either treating the alembic versions folder as a python module, either through the Debian packaging.

      Currently, when launching Drive not from the sources but from the pip installed package following https://github.com/nuxeo/nuxeo-drive/#ubuntudebian-and-other-linux-variants-client, we get:

      ataillefer@taillefer-xps:~$ ndrive --log-level-console=DEBUG
      2014-01-24 14:58:45,862 5431 140623817991936 DEBUG    nxdrive.controller nxdrive installed in '/usr/local/lib/python2.7/dist-packages/nxdrive'
      2014-01-24 14:58:45,862 5431 140623817991936 DEBUG    nxdrive.controller nxdrive configured in '/home/ataillefer/.nuxeo-drive'
      2014-01-24 14:58:45,868 5431 140623817991936 INFO     alembic.migration  Context impl SQLiteImpl.
      2014-01-24 14:58:45,869 5431 140623817991936 INFO     alembic.migration  Will assume non-transactional DDL.
      2014-01-24 14:58:45,869 5431 140623817991936 DEBUG    nxdrive.migration  Checking if SQLite database migration is needed.
      Traceback (most recent call last):
        File "/usr/local/bin/ndrive", line 6, in <module>
          sys.exit(main())
        File "/usr/local/lib/python2.7/dist-packages/nxdrive/commandline.py", line 505, in main
          return CliHandler().handle(argv)
        File "/usr/local/lib/python2.7/dist-packages/nxdrive/commandline.py", line 314, in handle
          timeout=options.timeout)
        File "/usr/local/lib/python2.7/dist-packages/nxdrive/controller.py", line 159, in __init__
          migrate_db(self._engine)
        File "/usr/local/lib/python2.7/dist-packages/nxdrive/migration.py", line 18, in migrate_db
          upgrade(config, engine, 'head')
        File "/usr/local/lib/python2.7/dist-packages/nxdrive/migration.py", line 39, in upgrade
          run_migration(engine)
        File "/usr/local/lib/python2.7/dist-packages/nxdrive/migration.py", line 71, in run_migration
          head_rev = context.get_head_revision()
        File "<string>", line 7, in get_head_revision
        File "/usr/local/lib/python2.7/dist-packages/alembic/environment.py", line 148, in get_head_revision
          return self.script._as_rev_number("head")
        File "/usr/local/lib/python2.7/dist-packages/alembic/script.py", line 122, in as_revision_number
          id_ = self.get_current_head()
        File "/usr/local/lib/python2.7/dist-packages/alembic/script.py", line 255, in get_current_head
          current_heads = self.get_heads()
        File "/usr/local/lib/python2.7/dist-packages/alembic/script.py", line 284, in get_heads
          for script in self._revision_map.values():
        File "/usr/local/lib/python2.7/dist-packages/alembic/util.py", line 233, in __get__
          obj.__dict__[self.__name__] = result = self.fget(obj)
        File "/usr/local/lib/python2.7/dist-packages/alembic/script.py", line 208, in _revision_map
          for file_ in os.listdir(self.versions):
      OSError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/alembic/versions'
      

      A workaround is to manually create a versions directory in the alembic installed Python module:

      sudo mkdir /usr/local/lib/python2.7/dist-packages/alembic/versions
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 1 day
                  1d
                  Remaining:
                  Remaining Estimate - 1 day
                  1d
                  Logged:
                  Time Spent - Not Specified
                  Not Specified