cubicweb-ctl db-check fails generically with error code 1 when db doesn't exist
cubicweb@francearchives-7c4ff6968-gt2vr:~$ CW_DB_NAME=asdf cubicweb-ctl db-check instance --checks=schema --autofix=no
/usr/lib/python3/dist-packages/rql/stmts.py:842: TargetRenamedDeprecationWarning: [logilab.common.deprecation] deprecated has been renamed and is deprecated, uses callable_deprecated instead
remove_group_var = deprecated('[rql 0.29] use remove_group_term instead')(remove_group_term)
/usr/lib/python3/dist-packages/cubicweb/server/serverctl.py:100: TargetRenamedDeprecationWarning: [logilab.common.deprecation] deprecated has been renamed and is deprecated, uses callable_deprecated instead
@deprecated('[3.28] instead of system_source_cnx(source, True, **args) use '
/usr/lib/python3/dist-packages/paste/request.py:33: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
from collections import MutableMapping as DictMixin
/home/cubicweb/.local/lib/python3.7/site-packages/cubicweb_oaipmh/__init__.py:16: TargetRenamedDeprecationWarning: [logilab.common.deprecation] deprecated has been renamed and is deprecated, uses callable_deprecated instead
@deprecated('[oaipmh 0.2] use isodate.datetime_isoformat')
/home/cubicweb/.local/lib/python3.7/site-packages/cubicweb_file/entities.py:147: TargetRenamedDeprecationWarning: [logilab.common.deprecation] deprecated has been renamed and is deprecated, uses callable_deprecated instead
@deprecated('[file 2.1] use entity.compute_hash() instead')
/home/cubicweb/.local/lib/python3.7/site-packages/cubicweb_file/entities.py:151: TargetRenamedDeprecationWarning: [logilab.common.deprecation] deprecated has been renamed and is deprecated, uses callable_deprecated instead
@deprecated('[file 1.9] use entity.cw_adapt_to("IDownloadable")'
/home/cubicweb/.local/lib/python3.7/site-packages/cubicweb_file/entities.py:156: TargetRenamedDeprecationWarning: [logilab.common.deprecation] deprecated has been renamed and is deprecated, uses callable_deprecated instead
@deprecated('[file 1.9] use entity.cw_adapt_to("IDownloadable")'
/home/cubicweb/.local/lib/python3.7/site-packages/cubicweb_file/entities.py:161: TargetRenamedDeprecationWarning: [logilab.common.deprecation] deprecated has been renamed and is deprecated, uses callable_deprecated instead
@deprecated('[file 1.9] use entity.cw_adapt_to("IDownloadable")'
/home/cubicweb/.local/lib/python3.7/site-packages/cubicweb_file/entities.py:166: TargetRenamedDeprecationWarning: [logilab.common.deprecation] deprecated has been renamed and is deprecated, uses callable_deprecated instead
@deprecated('[file 1.9] use entity.cw_adapt_to("IDownloadable")'
/home/cubicweb/.local/lib/python3.7/site-packages/cubicweb_file/entities.py:171: TargetRenamedDeprecationWarning: [logilab.common.deprecation] deprecated has been renamed and is deprecated, uses callable_deprecated instead
@deprecated('[file 1.9] use entity.cw_adapt_to("IDownloadable")'
/home/cubicweb/.local/lib/python3.7/site-packages/cubicweb_file/entities.py:177: TargetRenamedDeprecationWarning: [logilab.common.deprecation] deprecated has been renamed and is deprecated, uses callable_deprecated instead
@deprecated('[file 1.6] use entity.data_name instead')
/usr/lib/python3/dist-packages/jinja2/runtime.py:318: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
from collections import Mapping
/usr/lib/python3/dist-packages/logilab/database/postgres.py:480: TargetRenamedDeprecationWarning: [logilab.common.deprecation] deprecated has been renamed and is deprecated, uses callable_deprecated instead
@deprecated('[lgdb 1.10] deprecated method')
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/logilab/common/decorators.py", line 104, in __call__
return _cache[args]
KeyError: (True,)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/cubicweb/server/repository.py", line 287, in get
cnxset = self._queue.get_nowait()
File "/usr/lib/python3.7/queue.py", line 198, in get_nowait
return self.get(block=False)
File "/usr/lib/python3.7/queue.py", line 167, in get
raise Empty
_queue.Empty
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/cubicweb-ctl", line 11, in <module>
load_entry_point('cubicweb==3.28.2', 'console_scripts', 'cubicweb-ctl')()
File "/usr/lib/python3/dist-packages/cubicweb/cwctl.py", line 830, in run
CWCTL.run(args)
File "/usr/lib/python3/dist-packages/logilab/common/clcommands.py", line 149, in run
sys.exit(command.main_run(args, rcfile))
File "/usr/lib/python3/dist-packages/logilab/common/clcommands.py", line 290, in main_run
self.run(args)
File "/usr/lib/python3/dist-packages/cubicweb/server/serverctl.py", line 934, in run
repo, _cnx = repo_cnx(config)
File "/usr/lib/python3/dist-packages/cubicweb/server/serverctl.py", line 148, in repo_cnx
repo = repoapi.get_repository(config=config)
File "/usr/lib/python3/dist-packages/cubicweb/repoapi.py", line 31, in get_repository
return config.repository(vreg)
File "/usr/lib/python3/dist-packages/cubicweb/cwconfig.py", line 981, in repository
repo.bootstrap()
File "/usr/lib/python3/dist-packages/cubicweb/server/repository.py", line 406, in bootstrap
config.init_cubes(self.get_cubes())
File "/usr/lib/python3/dist-packages/cubicweb/server/repository.py", line 672, in get_cubes
or self.config.mode == 'test'))
File "/usr/lib/python3/dist-packages/logilab/common/decorators.py", line 76, in wrapped
return self.__call__(*args, **kwargs)
File "/usr/lib/python3/dist-packages/logilab/common/decorators.py", line 106, in __call__
_cache[args] = __me.callable(self, *args)
File "/usr/lib/python3/dist-packages/cubicweb/server/repository.py", line 694, in get_versions
with self.internal_cnx() as cnx:
File "/usr/lib/python3.7/contextlib.py", line 112, in __enter__
return next(self.gen)
File "/usr/lib/python3/dist-packages/cubicweb/server/repository.py", line 781, in internal_cnx
with Connection(self, InternalManager()) as cnx:
File "/usr/lib/python3/dist-packages/cubicweb/server/session.py", line 340, in __enter__
self.cnxset = self.repo.cnxsets.get()
File "/usr/lib/python3/dist-packages/cubicweb/server/repository.py", line 309, in get
return self._new_cnxset()
File "/usr/lib/python3/dist-packages/cubicweb/server/repository.py", line 238, in _new_cnxset
cnxset = super()._new_cnxset()
File "/usr/lib/python3/dist-packages/cubicweb/server/repository.py", line 190, in _new_cnxset
return self._source.wrapped_connection()
File "/usr/lib/python3/dist-packages/cubicweb/server/sqlutils.py", line 330, in wrapped_connection
return self.cnx_wrap(self)
File "/usr/lib/python3/dist-packages/cubicweb/server/sqlutils.py", line 182, in __init__
self.cnx = system_source.get_connection()
File "/usr/lib/python3/dist-packages/cubicweb/server/sqlutils.py", line 334, in get_connection
return self.dbhelper.get_connection()
File "/usr/lib/python3/dist-packages/logilab/database/__init__.py", line 796, in get_connection
extra_args=self.dbextraargs)
File "/usr/lib/python3/dist-packages/logilab/database/postgres.py", line 95, in connect
cnx = self._native_module.connect(cnx_string)
File "/usr/lib/python3/dist-packages/psycopg2/__init__.py", line 130, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: FATAL: database "asdf" does not exist
cubicweb@francearchives-7c4ff6968-gt2vr:~$ echo $?
1
We would find really useful for this traceback to be caught and a specific error code so we can use it to decide if we need to create the database or not.
Related to #202 (closed)