Puppet Class: puppet::puppetdb::compat

Inherits:
puppet::puppetdb::globals
Defined in:
manifests/puppetdb/compat.pp

Summary

Resolves conflicts caused by duplicate PuppetDB read connection settings in `database.ini`.

Overview

This class ensures that the PuppetDB package installation and the PuppetDB Puppet module do not create conflicting entries for the ‘read-database` connection settings. It removes the `database.ini` file generated during PuppetDB package installation to avoid errors when PuppetDB is configured.

Examples:

include puppet::puppetdb::compat


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'manifests/puppetdb/compat.pp', line 11

class puppet::puppetdb::compat inherits puppet::puppetdb::globals {
  $database_ini = "${puppet::puppetdb::globals::confdir}/database.ini"

  if $puppet::globals::use_compat_mode {
    include puppetdb

    #  Duplicate configuration entry: [:read-database :subname]
    exec { "rm -f ${database_ini}":
      path        => '/usr/bin:/bin',
      refreshonly => true,
      onlyif      => "grep -q read-database ${database_ini}",
      subscribe   => Package[$puppetdb::puppetdb_package],
      before      => Class['puppetdb::server::database'],
    }
  }
}