Don't throw exception when get_repo doesn't find repo

Instead, return an empty dict.
This commit is contained in:
Erik Johnson 2014-10-16 13:14:26 -05:00
parent ee7a17f55b
commit 0f18619216

View File

@ -1492,12 +1492,12 @@ def get_repo(repo, basedir='/etc/yum.repos.d', **kwargs): # pylint: disable=W06
for arepo in repos.keys():
if arepo == repo:
repofile = repos[arepo]['file']
if not repofile:
raise Exception('repo {0} was not found in {1}'.format(repo, basedir))
# Return just one repo
filerepos = _parse_repo_file(repofile)[1]
return filerepos[repo]
if repofile:
# Return just one repo
filerepos = _parse_repo_file(repofile)[1]
return filerepos[repo]
return {}
def del_repo(repo, basedir='/etc/yum.repos.d', **kwargs): # pylint: disable=W0613