Puppet Class: db2_install::fact_caching

Defined in:
manifests/fact_caching.pp

Summary

This class ensure's that the db2_install facts that can be cached and are cached with the correct settings.

Overview

db2_install::fact_caching

You can change all TTL settings for the facts if an other setting is more fitting for your setup.

See the file “LICENSE” for the full license governing this code.

Parameters:

  • enabled (Boolean)

    When set to true, this enables facter caching for the ora_install module facts. Beware that you need to have Facter version 4.1.0 or higher to enabled this. When you set this value to true, automatically TTL settings for most of the ora_install facts are set to a default value. For most installations, the default settings are fine. When you set this value to ‘true`, the [facter setting `force-dot-resolution`](tickets.puppetlabs.com/browse/PUP-11089) is enabled. You have to ensure that all of your facts keep on working with this setting.

  • product_version_ttl (Optional[String[1]])

    The Time to Live for the ‘db2_install_locations. product_version` part of the `db2_install_locations` fact.

  • installed_components_ttl (Optional[String[1]])

    The Time to Live for the ‘db2_install_locations. installed_parts` part of the `db2_install_locations` fact.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'manifests/fact_caching.pp', line 23

class db2_install::fact_caching (
  Boolean             $enabled,
  Optional[String[1]] $installed_components_ttl,
  Optional[String[1]] $product_version_ttl
) {
  if $enabled {
    include db2_install::clear_caches
    #
    # If enabled, we need to enable the force-dot-resolution
    # setting for facter.
    #
    unless defined(Fact_setting['force-dot-resolution']) {
      fact_setting { 'force-dot-resolution':
        value => true,
      }
    }

    fact_config { 'db2_install_locations.product_version':
      ttl => $product_version_ttl,
    }

    fact_config { 'db2_install_locations.installed_components':
      ttl => $installed_components_ttl,
    }
  } else {
    #
    # On puppet versions older than V6, the required libs
    # for fact_config are not installed. Because it also doesn't
    # serve any purpose, we skip this part on those versions.
    #
    if versioncmp($clientversion, '6.0.0') != -1 {
      #
      # Disable fact caching for all db2_install facts
      #
      $db2_install_facts = [
        'db2_install_locations.product_version',
        'db2_install_locations.installed_components',
      ]

      fact_config { $db2_install_facts:
        ttl => absent,
      }
    }
  }
}