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

Improve root schema upgrade procedure #1850

Open
hevp opened this issue Apr 19, 2021 · 2 comments
Open

Improve root schema upgrade procedure #1850

hevp opened this issue Apr 19, 2021 · 2 comments

Comments

@hevp
Copy link
Member

hevp commented Apr 19, 2021

If a new B2SHARE docker image is installed, and a new root schema (https://github.com/EUDAT-B2SHARE/b2share/blob/d857ef8c355f9961eaadb4057b88cc671427ef64/b2share/modules/schemas/root_schemas/root_schema_v1.json) is already loaded into the database, the upgrade procedure will fail.

This needs to be improved.

@defnull
Copy link

defnull commented Apr 19, 2021

So, there is currently no update path for existing instances? Thanks for the warning.

@defnull
Copy link

defnull commented Jul 21, 2021

Any news on this one? Upgrading an existing instance fails with:

b2share_1        | INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
b2share_1        | INFO  [alembic.runtime.migration] Will assume transactional DDL.
b2share_1        | Load root schemas.
b2share_1        | LOADING root schemas from "/eudat/b2share/b2share/modules/schemas/root_schemas".
b2share_1        | READING schema from "root_schema_v0.json"
b2share_1        | Traceback (most recent call last):
b2share_1        |   File "/usr/local/bin/b2share", line 33, in <module>
b2share_1        |     sys.exit(load_entry_point('b2share', 'console_scripts', 'b2share')())
b2share_1        |   File "/usr/local/lib/python3.6/site-packages/click/core.py", line 716, in __call__
b2share_1        |     return self.main(*args, **kwargs)
b2share_1        |   File "/usr/local/lib/python3.6/site-packages/flask/cli.py", line 345, in main
b2share_1        |     return AppGroup.main(self, *args, **kwargs)
b2share_1        |   File "/usr/local/lib/python3.6/site-packages/click/core.py", line 696, in main
b2share_1        |     rv = self.invoke(ctx)
b2share_1        |   File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1060, in invoke
b2share_1        |     return _process_result(sub_ctx.command.invoke(sub_ctx))
b2share_1        |   File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1060, in invoke
b2share_1        |     return _process_result(sub_ctx.command.invoke(sub_ctx))
b2share_1        |   File "/usr/local/lib/python3.6/site-packages/click/core.py", line 889, in invoke
b2share_1        |     return ctx.invoke(self.callback, **ctx.params)
b2share_1        |   File "/usr/local/lib/python3.6/site-packages/click/core.py", line 534, in invoke
b2share_1        |     return callback(*args, **kwargs)
b2share_1        |   File "/usr/local/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
b2share_1        |     return f(get_current_context(), *args, **kwargs)
b2share_1        |   File "/usr/local/lib/python3.6/site-packages/flask/cli.py", line 229, in decorator
b2share_1        |     return __ctx.invoke(f, *args, **kwargs)
b2share_1        |   File "/usr/local/lib/python3.6/site-packages/click/core.py", line 534, in invoke
b2share_1        |     return callback(*args, **kwargs)
b2share_1        |   File "/eudat/b2share/b2share/modules/upgrade/cli.py", line 45, in run
b2share_1        |     upgrade_to_last_version(verbose)
b2share_1        |   File "/eudat/b2share/b2share/modules/upgrade/api.py", line 86, in upgrade_to_last_version
b2share_1        |     upgrade.run(failed_migration=last_failure, verbose=verbose)
b2share_1        |   File "/eudat/b2share/b2share/modules/upgrade/api.py", line 48, in decorator
b2share_1        |     f(*args, **kwargs)
b2share_1        |   File "/eudat/b2share/b2share/modules/upgrade/api.py", line 235, in run
b2share_1        |     raise e
b2share_1        |   File "/eudat/b2share/b2share/modules/upgrade/api.py", line 215, in run
b2share_1        |     step.run(alembic, verbose)
b2share_1        |   File "/eudat/b2share/b2share/modules/upgrade/upgrades/common.py", line 91, in schemas_init
b2share_1        |     load_root_schemas(cli=True, verbose=verbose, ignore_mismatches=True)
b2share_1        |   File "/eudat/b2share/b2share/modules/schemas/helpers.py", line 239, in load_root_schemas
b2share_1        |     os.path.join(root_schemas_dir, filename)),
b2share_1        | b2share.modules.schemas.errors.RootSchemaAlreadyExistsError: 400: Bad Request

Is there documentation available on how to properly upgrade an existing instance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants