From e9c042bab7127b1fd1dd2315ec67d3aa51e1ecef Mon Sep 17 00:00:00 2001 From: Seth Vidal Date: Thu, 4 Jul 2013 17:08:59 -0400 Subject: [PATCH] simple optimization for the extremely common case --- library/yum | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/library/yum b/library/yum index 8d40a92788..5d38bcab32 100644 --- a/library/yum +++ b/library/yum @@ -409,6 +409,13 @@ def install(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos): # range requires or file-requires or pkgname :( else: + # most common case is the pkg is already installed and done + # short circuit all the bs - and search for it as a pkg in is_installed + # if you find it then we're done + if is_installed(module, repoq, spec, conf_file, en_repos=en_repos, dis_repos=dis_repos, is_pkg=True): + res['results'].append('%s providing %s is already installed' % (this, spec)) + continue + # look up what pkgs provide this pkglist = what_provides(module, repoq, spec, conf_file, en_repos=en_repos, dis_repos=dis_repos) if not pkglist: