Search code examples
hashstringifyfacter

Puppet stringify facts


I have a problem with puppet and facter.

puppet --version -> 3.8.6
facter --version -> 2.4.6

I write a fact for softwareinventory with returnvalue a nested hash

like this:

    apps = {  
    'Notepad++' => {  
         'Displayname'    => 'Notepad++'  
         'Displayversion' => '6.8.3'  
                   }  
    'Puppet(64-bit)' => {  
         'Displayname'    => 'Puppet(64-bit)'  
         'Displayversion' => '3.8.6'  
                   }  
          }  

The puppet.conf on the client and on server have included: stringify_facts = false

If i test on the client with a local manifest test.pp with content:
notify {$::packages['Notepad++']['Displayversion']

puppet apply test.pp
i get the right value = 6.8.3

facter -p packages returns a hash like expected.

but with a puppetrun:
puppet agent -t -d -v

Error: Could not retrieve catalog from remote server: Error 400 on SERVER:  
packages is not a hash or array when accessing it with ....

If i curl the puppetdb: curl -k http://puppetdbname:8080/v3/nodes/nodename/facts/packages

i can see only a string !

Can anyone help please. Any ideas?

Thanks Taner


Solution

  • i found out puppetdbv3 show the facts always as string and puppetdbv4 do not. I tested again on my puppetserver and i could access to my hash -> packages normally.

    regards Taner