From 326b160241a45076ec8db5322953c734b48c6d31 Mon Sep 17 00:00:00 2001 From: Seth Vidal Date: Fri, 19 Oct 2012 16:28:39 -0400 Subject: [PATCH] when a pkg is installed, but not from any repo, don't error out that it is not installed. Also when a pkg is both installed and in a repo do not look it up more than once --- library/yum | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/library/yum b/library/yum index b63dfeb987a..ee96b521208 100755 --- a/library/yum +++ b/library/yum @@ -212,7 +212,10 @@ def what_provides(module, repoq, req_spec, conf_file, qf=def_qf): rc2,out2,err2 = run(cmd) if rc == 0 and rc2 == 0: out += out2 - return set([ p for p in out.split('\n') if p.strip() ]) + pkgs = set([ p for p in out.split('\n') if p.strip() ]) + if not pkgs: + pkgs = is_installed(module, repoq, req_spec, conf_file, qf=qf) + return pkgs else: module.fail_json(msg='Error from repoquery: %s' % err + err2) @@ -350,6 +353,7 @@ def install(module, items, repoq, yum_basecmd, conf_file): if is_installed(module, repoq, this, conf_file): found = True res['results'].append('%s providing %s is already installed' % (this, spec)) + break if found: continue