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):
|
if not os.path.exists(source_path):
|
||||||
return []
|
return []
|
||||||
|
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser(strict=False)
|
||||||
cfg.read(source_path)
|
cfg.read(source_path)
|
||||||
return cfg.sections()
|
return cfg.sections()
|
||||||
|
|
||||||
@ -587,7 +587,7 @@ def delete_repo_source(source_glob, source_name):
|
|||||||
found = False
|
found = False
|
||||||
for f in glob(source_glob):
|
for f in glob(source_glob):
|
||||||
try:
|
try:
|
||||||
cfg = ConfigParser()
|
cfg = ConfigParser(strict=False)
|
||||||
cfg.read(f)
|
cfg.read(f)
|
||||||
if source_name in cfg.sections():
|
if source_name in cfg.sections():
|
||||||
found = True
|
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