3

[PUP-7878] Change in Puppet type management breaks defined class checks - Puppet...

 2 years ago
source link: https://tickets.puppetlabs.com/browse/PUP-7878
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
[PUP-7878] Change in Puppet type management breaks defined class checks

Details

Description

After upgrading the puppet version on a puppet server from 5.0.1 to 5.1.0 puppet runs on all nodes referencing that master now fail with the same type of error. Downgrading the server's puppet version back to 5.0.1 results in no errors again.

The bug appear to be related to PUP-7670.

[[email protected] ~]# puppet agent -t
Info: Using configured environment 'infrastructure'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, uninitialized constant Puppet::Pops::Types::PClassType at /etc/puppetlabs/code/environments/infrastructure/modules/puppetdb/manifests/master/config.pp:4:34 on node puppet.mydomain}}
When looking at the code referenced, it appears that it is choking on a very common template
{{class puppetdb::master::config (
  $puppetdb_server             = $::fqdn,
  $puppetdb_port               = defined(Class['puppetdb']) ? {

ie - the defined(Class['foo']) is what causes the problem. On playing on other nodes, not the puppet master, I see the same error in various different modules, depending on what the node requires. For example, on a webserver node using Apache the line that trips this up is:

[[email protected] ~]# puppet agent -t
Info: Using configured environment 'application'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Function Call, uninitialized constant Puppet::Pops::Types::PClassType at /etc/puppetlabs/code/environments/application/modules/apache/manifests/service.pp:27:8 at /etc/puppetlabs/code/environments/application/modules/webserver/manifests/static.pp:77 on node mezabaan1.mydomain
if ! defined(Class\['apache::params'])

I can replicate the exact same error in my own modules using the same code pattern.

Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Function Call, uninitialized constant Puppet::Pops::Types::PClassType at /etc/puppetlabs/code/environments/application/modules/ntpd/manifests/config.pp:5:8 on node mezabaan1.mydomain
define ntpd::config (
  Array[String] $local_servers = [],
) {
if ! defined( Class['ntpd::master'])

etc etc.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK