Use strict=False when reading repo files
In some cases they may contain duplicate sections. With it set to False the last one wins instead of causing a traceback. Related: rhbz#1678937
This commit is contained in:
parent
a30afe6e5c
commit
e85174abce
@ -553,7 +553,7 @@ def get_source_ids(source_path):
|
||||
if not os.path.exists(source_path):
|
||||
return []
|
||||
|
||||
cfg = ConfigParser()
|
||||
cfg = ConfigParser(strict=False)
|
||||
cfg.read(source_path)
|
||||
return cfg.sections()
|
||||
|
||||
@ -587,7 +587,7 @@ def delete_repo_source(source_glob, source_name):
|
||||
found = False
|
||||
for f in glob(source_glob):
|
||||
try:
|
||||
cfg = ConfigParser()
|
||||
cfg = ConfigParser(strict=False)
|
||||
cfg.read(f)
|
||||
if source_name in cfg.sections():
|
||||
found = True
|
||||
|
23
tests/pylorax/repos/duplicate-test.repo
Normal file
23
tests/pylorax/repos/duplicate-test.repo
Normal file
@ -0,0 +1,23 @@
|
||||
[duplicate-repo]
|
||||
name=Duplicate repo #1
|
||||
failovermethod=priority
|
||||
baseurl=file:///tmp/lorax-empty-repo/
|
||||
enabled=1
|
||||
metadata_expire=7d
|
||||
repo_gpgcheck=0
|
||||
type=rpm
|
||||
gpgcheck=1
|
||||
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
|
||||
skip_if_unavailable=False
|
||||
|
||||
[duplicate-repo]
|
||||
name=Duplicate repo #2
|
||||
failovermethod=priority
|
||||
baseurl=file:///tmp/lorax-empty-repo/
|
||||
enabled=1
|
||||
metadata_expire=7d
|
||||
repo_gpgcheck=0
|
||||
type=rpm
|
||||
gpgcheck=1
|
||||
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
|
||||
skip_if_unavailable=False
|
Loading…
Reference in New Issue
Block a user