1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-01 04:36:13 +01:00

Allow starting with an empty config if --configfile is either empty or points to /dev/null

This commit is contained in:
Daniel Mach 2024-01-04 16:33:38 +01:00
parent b5c8fa75ea
commit b41afde2c9

View File

@ -1824,6 +1824,10 @@ def get_config(override_conffile=None,
else:
conffile = identify_conf()
if conffile in ["", "/dev/null"]:
cp = OscConfigParser.OscConfigParser()
cp.add_section("general")
else:
conffile = os.path.expanduser(conffile)
if not os.path.exists(conffile):
raise oscerr.NoConfigfile(conffile, account_not_configured_text % conffile)
@ -1841,7 +1845,7 @@ def get_config(override_conffile=None,
cp = get_configParser(conffile)
if not cp.has_section('general'):
if not cp.has_section("general"):
# FIXME: it might be sufficient to just assume defaults?
msg = config_incomplete_text % conffile
defaults = Options().dict()