Add support to avoid calling refresh_db in opkg.del_repo

Since refresh_db is a costly operation we should have the option of not calling that

Signed-off-by: Cristian Hotea <cristian.hotea@ni.com>
This commit is contained in:
Cristian Hotea 2018-08-30 12:58:41 +03:00 committed by Ch3LL
parent b6028b907b
commit f66d47451b
No known key found for this signature in database
GPG key ID: 132B55A7C13EFA73

View file

@ -1154,6 +1154,7 @@ def del_repo(alias, **kwargs): # pylint: disable=unused-argument
salt '*' pkg.del_repo alias
'''
refresh = salt.utils.data.is_true(kwargs.get('refresh', True))
repos = list_repos()
if repos:
deleted_from = dict()
@ -1179,8 +1180,8 @@ def del_repo(alias, **kwargs): # pylint: disable=unused-argument
except OSError:
pass
ret += msg.format(alias, repo_file)
# explicit refresh after a repo is deleted
refresh_db()
if refresh:
refresh_db()
return ret
return "Repo {0} doesn't exist in the opkg repo lists".format(alias)