swh-fuse: fails with "'TypeError: Cannot merge a <class 'dict'> with a <class 'NoneType'>" when conffile is empty or commented out
When ~/.config/swh/global.yml
is either empty or entirely commented out (with #
lines), swh fuse mount
fails with the following type error:
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 1256, in invoke
Command.invoke(self, 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 67, in fuse
conf = config.merge_configs(DEFAULT_CONFIG, conf)
File "/home/zack/dati/projects/sw-heritage/git/swh-environment/swh-core/swh/core/config.py", line 224, in merge_configs
raise TypeError("Cannot merge a %s with a %s" % (type(base), type(other)))
TypeError: Cannot merge a <class 'dict'> with a <class 'NoneType'>
that is unfortunate, given one of the main interests of YAML for configuration files is the ability to comment out stuff (and an empty configuration file is an entirely legitimate thing as well).
Migrated from T2710 (view on Phabricator)