undefined method platform for nil:NilClass since puppetserver upgrade

187 views
Skip to first unread message

Andy Hall

unread,
Jul 16, 2020, 3:14:34 AM7/16/20
to puppet...@googlegroups.com
hey there I recently update puppetserver to 6.12.1 ( along with
puppetdb to 6.11.2 and puppet-agent to 6.17.0 ) and occasionally on
some puppet runs ( I cannot determine why it happens sometimes and not
others ) we see the following reported...

Error while evaluating a Virtual Query, undefined method `platform'
for nil:NilClass (file:
/etc/puppetlabs/code/environments/production/manifests/site.pp, line:
14, column: 3)

...this is the very first manifest that gets parsed and here is the
code itself ( I have compressed it but will refer to the line in
question )...

# site.pp
# global resource defaults
Exec { path => '/bin:/sbin:/usr/bin:/usr/sbin' }
File { backup => 'main' }
User { managehome => true }
# global resource ordering - rhsm before yumrepos
$rhsmtrue = hiera('flex::general::redhat::manage_rhsm',false)
if("${rhsmtrue}" and $::operatingsystem == 'RedHat'){
Rhsm_register <| |> -> Yumrepo <| |> -> Package <| provider != 'rpm'
|> <-- THIS IS THE LINE IN QUESTION
}
else{
Yumrepo <| |> -> Package <| provider != 'rpm' |>
}
# use flex roles and profiles for all nodes
node default {
include ::flex
}

Can anyone please help explain what may be happening here ? I can
confirm that we do not see this error in our logs prior to the
upgrade.

As it is calling the "rhsm_register" type could it be the
subscription_manager module we are running is no longer supported by
the version of puppet ?

But surely you would not break code within a major 6.x release ?

Thanks for any help you can provide !!

Becca Robinson

unread,
Jul 16, 2020, 10:55:54 AM7/16/20
to puppet...@googlegroups.com
Hi Andy,

I haven’t seen this before, but I have a thought.
Have you tried removing the new line at the end so the closing of the package resource collector isn’t on a new line?

Similar to this?


if("${rhsmtrue}" and $::operatingsystem == 'RedHat'){
  Rhsm_register <| |> 
  -> Yumrepo <| |> 
  -> Package <| provider != ‘rpm' |>
}
else{
 Yumrepo <| |> -> Package <| provider != 'rpm' |>
}

-- 
Becca Robinson



Andy Hall

unread,
Jul 17, 2020, 6:59:42 AM7/17/20
to Puppet Users
So here's a strange one....we rebooted the server and the problem has stopped. I think some of the puppetserver instances were not running properly....which is why it was intermittent....but hey all OK now. Thanks.
Reply all
Reply to author
Forward
0 new messages