voxpupuli / puppet-yum

Puppet module for Yum
https://forge.puppet.com/puppet/yum
MIT License
16 stars 99 forks source link

yum_updates fact: too slow #280

Open otheus opened 1 year ago

otheus commented 1 year ago

The yum_updates and yum_has_updates facts are too slow. On a reasonably fast system, 4 to 6s are needed to resolve this fact. Just because we want a yum module to manage packages and repositories, we don't want to drag in a pointless fact when it incurs such a (relatively) high time- and resource cost.

Thus, this shouldn't be a fact unless it can be done with little cost.

However, I'm against deprecating existing features when security is not the primary issue.

Instead, the algorithm can be improved by caching the result.

otheus commented 1 year ago

It's underdocumented, and not well implemented, but these can be cached by puppet 3.14.10 and higher by modifying $PUPPET_CONFIG_DIR/facter/facter.conf:

facts : {
  ttls : [
    { "cached-custom-facts" : 1 day },
  ]
}
fact-groups :  {
 cached-custom-facts : [
    "yum_has_updates", "yum_updates", "yum_package_updates",
 ]
}

I also recommend package_provider, rsyslog_version since these are relatively slow as well.