mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Don't throw exception when get_repo doesn't find repo
Instead, return an empty dict.
This commit is contained in:
parent
ee7a17f55b
commit
0f18619216
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user