FUSE: mount fail when cache directory is missing
$ rm -rf ~/.cache/swh/fuse
$ swh fuse mount --foreground swhfs/
ERROR:aiosqlite:returning exception unable to open database file
Traceback (most recent call last):
File "/home/zack/.virtualenvs/swh/lib/python3.8/site-packages/aiosqlite/core.py", line 95, in run
result = function()
File "/home/zack/.virtualenvs/swh/lib/python3.8/site-packages/aiosqlite/core.py", line 346, in connector
return sqlite3.connect(loc, **kwargs)
sqlite3.OperationalError: unable to open database file
Traceback (most recent call last):
File "/home/zack/.virtualenvs/swh/bin/swh", line 33, in <module>
sys.exit(load_entry_point('swh.core', 'console_scripts', 'swh')())
File "/home/zack/dati/projects/sw-heritage/git/swh-environment/swh-core/swh/core/cli/__init__.py", line 135, in main
return swh(auto_envvar_prefix="SWH")
File "/home/zack/.virtualenvs/swh/lib/python3.8/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/home/zack/.virtualenvs/swh/lib/python3.8/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/home/zack/.virtualenvs/swh/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/zack/.virtualenvs/swh/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/zack/.virtualenvs/swh/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/zack/.virtualenvs/swh/lib/python3.8/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/home/zack/.virtualenvs/swh/lib/python3.8/site-packages/click/decorators.py", line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/zack/dati/projects/sw-heritage/git/swh-environment/swh-fuse/swh/fuse/cli.py", line 104, in mount
asyncio.run(fuse.main(swhids, path, conf))
File "/usr/lib/python3.8/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "/home/zack/dati/projects/sw-heritage/git/swh-environment/swh-fuse/swh/fuse/fuse.py", line 205, in main
async with FuseCache(conf["cache"]) as cache:
File "/home/zack/dati/projects/sw-heritage/git/swh-environment/swh-fuse/swh/fuse/cache.py", line 39, in __aenter__
await self.metadata.__aenter__()
File "/home/zack/dati/projects/sw-heritage/git/swh-environment/swh-fuse/swh/fuse/cache.py", line 86, in __aenter__
await super().__aenter__()
File "/home/zack/dati/projects/sw-heritage/git/swh-environment/swh-fuse/swh/fuse/cache.py", line 72, in __aenter__
self.conn = await aiosqlite.connect(path)
File "/home/zack/.virtualenvs/swh/lib/python3.8/site-packages/aiosqlite/core.py", line 115, in _connect
self._connection = await self._execute(self._connector)
File "/home/zack/.virtualenvs/swh/lib/python3.8/site-packages/aiosqlite/core.py", line 109, in _execute
return await future
File "/home/zack/.virtualenvs/swh/lib/python3.8/site-packages/aiosqlite/core.py", line 95, in run
result = function()
File "/home/zack/.virtualenvs/swh/lib/python3.8/site-packages/aiosqlite/core.py", line 346, in connector
return sqlite3.connect(loc, **kwargs)
sqlite3.OperationalError: unable to open database file
Migrated from T2698 (view on Phabricator)