From fc02992bcdd4ae672e0d08343d865f7371c800dc Mon Sep 17 00:00:00 2001 From: Seth Vidal Date: Tue, 27 Mar 2012 14:15:48 -0400 Subject: [PATCH] make sure latest outputs an error if the thing you've listed as 'latest' is not there at all or even updateable --- library/yum | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/yum b/library/yum index cf9a697edd1..524b3a0ebd0 100755 --- a/library/yum +++ b/library/yum @@ -217,7 +217,9 @@ def ensure(my, state, pkgspec): updates = my.doPackageLists(pkgnarrow='updates', patterns=[pkgspec]).updates avail = my.doPackageLists(pkgnarrow='available', patterns=[pkgspec]).available if not updates and not avail: - # there nothing in updates matching this. + if not my.doPackageLists(pkgnarrow='installed', patterns=[pkgspec]).installed: + msg = "No Package matching '%s' found available, installed or updated" % pkgspec + return { 'changed':False, 'failed':True, 'msg': msg } return { 'changed':False,} # we have something in updates or available @@ -226,6 +228,7 @@ def ensure(my, state, pkgspec): else: cmd = "yum -c %s -d1 -y update '%s'" % (yumconf, pkgspec) rc, out, err = run_yum(cmd) + # FIXME if it is - update it and check to see if it applied # check to see if there is no longer an update available for the pkgspec if rc: