diff --git a/manifests/master/routes.pp b/manifests/master/routes.pp index a5f01ee..8920610 100644 --- a/manifests/master/routes.pp +++ b/manifests/master/routes.pp @@ -1,44 +1,51 @@ # Manages the routes configuration file on the master. See README.md for more # details. class puppetdb::master::routes ( $puppet_confdir = $puppetdb::params::puppet_confdir, $masterless = $puppetdb::params::masterless, - $routes = { - 'master' => { - 'facts' => { - 'terminus' => 'puppetdb', - 'cache' => 'yaml', - } - } - } + $routes = undef, ) inherits puppetdb::params { if $masterless { $routes_real = { 'apply' => { 'catalog' => { 'terminus' => 'compiler', 'cache' => 'puppetdb', }, 'facts' => { 'terminus' => 'facter', 'cache' => 'puppetdb_apply', } } } - } else { + } elsif $routes { $routes_real = $routes + } else { + if versioncmp($serverversion, '7.0') == -1 { + $default_fact_cache = 'yaml' + } else { + $default_fact_cache = 'json' + } + $routes_real = { + 'master' => { + 'facts' => { + 'terminus' => 'puppetdb', + 'cache' => $default_fact_cache, + } + } + } } # TODO: this will overwrite any existing routes.yaml; # to handle this properly we should just be ensuring # that the proper settings exist, but to do that we'd need # to parse the yaml file and rewrite it, dealing with indentation issues etc # I don't think there is currently a puppet module or an augeas lens for # this. file { "${puppet_confdir}/routes.yaml": ensure => file, content => template('puppetdb/routes.yaml.erb'), mode => '0644', } }