simple optimization for the extremely common case

This commit is contained in:
Seth Vidal 2013-07-04 17:08:59 -04:00
parent cc086458e1
commit e9c042bab7

View file

@ -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: