Forum: CFEngine Help
Subject: Accessing package manager cache for other purposes?
Author: sauer
Link to topic: https://cfengine.com/forum/read.php?3,23088,23088#msg-23088

So, when I use a package manager method such as yum on a system, CFEngine 
builds a list of all installed packages the first time it's referenced.  
Subsequent package instalations / etc then use that cache rathr than listing 
everything again, apparently using the package_list_update_ifelapsed value.

I have a need to alter a promise's behavior if a certain package is installed 
on the system.  However, I do not want to install the package if it's missing - 
nor do I want to verify the package, as verification may fail for silly reasons 
like adjusted permissions.  Is there a way to define a class for an installed 
package and to do so without forking an additional process, but rather, by just 
checking the already existing installed-packages cache?  Right now, I'm just 
checking for the existances of a critical file from each given package, which 
is only slightly less lame than firing up "rpm -q" 50+ times. :)

If this is not currently possible, I'd probably suggest an additional special 
function along the lines of is_package_installed(package_method, 
package_regexp) which could either populate that cache if it doesn't exist or 
use the cache if it does - and which could be used on the RHS of an expression 
parameter within a class definition.  A couple of related functions like 
list_packages_matching(method, pattern) and get_package_version(method, 
pattern) might also be handy. :)

_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to