Error hiera lookup on hardware only- expects a String value, got Tuple

Hello,

We have been using Foreman for more than 3 years now to patch and manage our Windows systems. The version 1.12. is now also a bit older and CentOS release 6.8 is also a bit older. So I started to switch to CentOS Linux release 8.2.2004 and foreman-2.1.0-1. I could already change most of the virtual TestVMs with one procedure to new foreman server and to puppet agent 6.17. All without any problems but with the hardware it always results in an error.

Debug: Caching connection for https://xxxx.domainxxx.xxx:8140
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, Found value has wrong type, variant 0 expects a String value, got Tuple
  Found value has wrong type, variant 1 index 0 expects a String value, got Undef (file: /etc/puppetlabs/code/environments/production/manifests/site.pp, line: 3, column: 14) on node puppetclient.domainxxx.xxx
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

Our site.pp manifest file looks like this

node default {
# Find the first instance of 'classes' in hiera data and includes unique values Does not merge results.
  $classes = lookup('classes', Variant[String,Array[String]])
  case $classes {
    String[1]: {
      include $classes
    }
    Array [String[1],1]: {
      $classes.unique.include
    }
    default: {
      fail('This node did not receive any classification')
    }
  }
}

Unfortunately, the puppet agent -t -debug does not help to find the wrong value. Why does everything work on VMware clients but not on hardware ?
I have already tried older agents but all with the same result.

I would be grateful for any help or hints to solve the problem. Many thanks in advance.

Hi,

while this is quite surely a Puppet-only problem (not a Foreman one), I will still try to help.
First off: Puppet agent does not report any more infos because the problem is server sided. You should have a look at the puppet server’s log and check if you can find any more info there (depending on your setup, there might be different locations for that log, but it should usually be somewhere under /var/log/puppetlabs and/or in journalctl).
From what I see though, the problem seems to be that the lookup function fails due to a wrong type of the “classes” value from hiera. Since it is reported as Undef type, I would assume it does not find any classes. My recommendation would be to check your hirarchy with the facts from the problematic host and see if maybe you have found an edge case where there can not be any classes found for that host.

Regards

Hello Areyus, thank you for the quick response and for the hint, I will look into it, I will see if I can find the problem on the puppet server. Thanks again and kind Regards

With your hint to look directly on the server, I was successful I still had two *.yaml files that contained the old notation of class assignment (Hiera 3). I changed it and then it worked again.

Thanks again for the help.
Kind Regards,

1 Like

Glad I could help :slight_smile:
Would you please mark the relevant answer as “solution” so others can see the problem is already solved?

Regards