0

I have a module named oss_puppetserver that has an init.pp and a database.pp.

The database.pp class is enabled/included/assigned via hiera for a host, the module itself makes use of the existing puppetlabs-postgresql module that is deployed to /etc/puppet/environments/testing/modules/postgresql via r10k and the oss_puppetserver module is deployed to /etc/puppet/environments/testing/site/oss_puppetserver, the file database.pp contains the following code:

class oss_puppetserver::database {

  class { 'postgresql::globals':
    manage_package_repo => true,
    version             => '9.4',
    repo_proxy          => 'proxy:8080',
    datadir             => '/opt/pgpuppet/data',
    xlogdir             => '/opt/pgpuppet/xlog',
    logdir              => '/opt/pgpuppet/log',
  } ->
  class { 'postgresql::server':
    ip_mask_deny_postgres_user => '0.0.0.0/32',
    ip_mask_allow_all_users    => '0.0.0.0/0',
    listen_addresses           => '*',
  }
  postgresql::server::db { 'test1':
     user    => 'test2',
     password => 'test2',
  }
}

init.pp:

#lots of descriptive comments
class oss_puppetserver {
}

However the issue seems to be that the node seems to be returning the following:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Invalid parameter onlyif on Postgresql_psql[grant:database:GRANT test2 - ALL - test1] at /etc/puppet/environments/testing/modules/postgresql/manifests/server/grant.pp:229 on node host.test.bla
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

It seems to keep hanging up on the defined type and i have no idea why, ive looked at the code inside grant.pp and these seem to be the offending lines:

  $_onlyif = $onlyif_function ? {
'table_exists' => "SELECT true FROM pg_tables WHERE tablename = '${_togrant_object}'",
    default        => undef,
  }

  $grant_cmd = "GRANT ${_privilege} ON ${_object_type} \"${_togrant_object}\" TO
  \"${role}\""
  postgresql_psql { "grant:${name}":
    command    => $grant_cmd,
    db         => $on_db,
    port       => $port,
    psql_user  => $psql_user,
    psql_group => $group,
    psql_path  => $psql_path,
    unless     => $_unless,
    onlyif     => $_onlyif,
    require    => Class['postgresql::server']
  }

albeit i am not quite able to discern why exactly it is failing or why the parameter would be invalid as the errormessage suggests.

I have tried to redploy the modules and rewrite the class multiple times. I can only assume at this point that the issue seems to be with having class declarations inside a class and missing something along the lines of an include or requires. But my attempts have been futile so far. Either that or I am missing something extremely obvious. I would appreciate any help or suggestion at this point since the other serverfault postings that included the Error 400 Invalid Parameter XXX posts didnt make a lot of sense to me, at least it wasnt relatable to me from my point of view, maybe i just misunderstood.

Thanks ahead of time for any suggestions as to what i could possibly try or do to solve the issue.

1 Answer 1

0

So, i just wanted to post an answer to my own question, it seems like there was an issue with puppetserver caching the types and providers for the module. I have redployed it with 'r10k puppetfile install -v' and then restarted the puppetserver. Something appears to have gotten stuck in the cache.

Now this issue seems to be fixed and everything is working fine. I hope this helps someone out down along the line.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .