thias / puppet-nagios

Puppet Nagios module
Other
23 stars 72 forks source link

Duplicate declaration errors when both nvme and nagios_pci_megaraid_sas are true #175

Closed hundredacres closed 2 years ago

hundredacres commented 4 years ago

On a host where nagios_pci_megaraid_sas => true and nvme disks are present, the following error occurs:

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Class[Nagios::Check::Ssd] is already declared at (file: /etc/puppetlabs/code/environments/production/modules/nagios/manifests/client.pp, line: 160); cannot redeclare (file: /etc/puppetlabs/code/environments/production/modules/nagios/manifests/client.pp, line: 162) (file: /etc/puppetlabs/code/environments/production/modules/nagios/manifests/client.pp, line: 162, column: 46) on node is03.riskiq
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

Disk info from facter

disks => {
  nvme0n1 => {
    model => "INTEL SSDPEDME016T4",
    size => "1.46 TiB",
    size_bytes => 1600321314816
  },
  sda => {
    model => "PERC H710P",
    size => "1.27 TiB",
    size_bytes => 1396132806656,
    vendor => "DELL"
  }
}

I submitted a PR to fix, where we switch from declaring the class to including it.

thias commented 2 years ago

Good catch, and thanks for the fix! I've included 694a0b13054df0e3c5c2dedf4d75642933ca8809