I am attempting to use the Puppet puppetdb and postgresql modules from the 
forge to have postgresql live on a separate server from puppetdb itself. It's 
not going brilliantly as I'm not understanding how to inform the postgresql 
module about what version of postgresql is in use for a versioncmp in 
postgresql::server::role.

My questions to other people who have put postgresql on another host, or read 
puppet dsl better than me,  would be these:

1) which classes and params did you declare in the profile to get over this 
hump?
2) am I able to get $connect_settings fed into postgresql::server::role somehow?

Exhibit A, mildly tweaked for privacy:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: 
Evaluation Error: Error while evaluating a Resource Statement, Evaluation 
Error: Error while evaluating a Function Call, 'versioncmp' parameter 'a' 
expects a String value, got Undef at 
/etc/puppetlabs/code/environments/puppetmasters_test/modules/postgresql/manifests/server/role.pp:95:6
 at 
/etc/puppetlabs/code/environments/puppetmasters_test/modules/postgresql/manifests/server/db.pp:30
 on node temphost1.me.com

The puppetlabs-puppetdb module is at 5.1.2 (b641845), and the 
puppetlabs-postgresql module is at 4.9.0 (3021eb3).

The puppetdb module is currently in the profile like so (still working out all 
the things I need here):

  class { '::puppetdb':
    certificate_whitelist => [
      'cwood',
      'some.more',
      'etc.',
    ],
    conn_keep_alive       => '5',
    database_host         => 'db.me.com',
    java_args             => {
      '-Xmx' => '2g',
      '-Xms' => '512m',
    },
    jdbc_ssl_properties   => 
'?ssl=true&sslfactory=org.postgresql.ssl.jdbc4.LibPQFactory&sslmode=verify-full&sslrootcert=/etc/puppetlabs/puppetdb/ssl/ca.pem',
    manage_dbserver       => false,
    manage_package_repo   => false,
    node_purge_ttl        => '1d',
    node_ttl              => '14d',
    postgres_version      => '9.5',
  }


If I'm reading this correctly the puppetdb::database::postgresql class is 
declared in the puppetdb class. I am not managing postgresql itself on this 
server (manage_dbserver above) so the postgresql::server::db (defined type) 
declares (a) postgresql::server::role (defined type) without declaring the 
postgresql::server class.

https://github.com/puppetlabs/puppetlabs-puppetdb/blob/5.1.2/manifests/init.pp
https://github.com/puppetlabs/puppetlabs-puppetdb/blob/5.1.2/manifests/database/postgresql.pp
https://github.com/puppetlabs/puppetlabs-postgresql/blob/4.9.0/manifests/server/role.pp
https://github.com/puppetlabs/puppetlabs-postgresql/blob/4.9.0/manifests/server/db.pp

The catch appears to be that postgresql::server::role uses $connect_settings as 
a parameter, but it is declared as such in postgresql::server::db:

  if ! defined(Postgresql::Server::Role[$user]) {
    postgresql::server::role { $user:
      password_hash => $password,
      before        => Postgresql::Server::Database[$dbname],
    }
  }

However the version is taken from this in role.pp:

  # If possible use the version of the remote database, otherwise
  # fallback to our local DB version
  if $connect_settings != undef and has_key( $connect_settings, 'DBVERSION') {
    $version = $connect_settings['DBVERSION']
  } else {
    $version = $postgresql::server::_version
  }

Neither of the $version assignments there work so $version ends up null and 
this check on line 95 of role.pp produces the error above:

  if(versioncmp($version, '9.1') >= 0) {

This is the wall upon which my head is currently beating, if anybody has any 
hints.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/20170424210813.GA21371%40iniquitous.heresiarch.ca.
For more options, visit https://groups.google.com/d/optout.

Reply via email to