0

I have a Problem with puppetdb and my structured facts (hashes).

Hashes will stringified through my puppetdb.

Ubuntu 14.04
puppetserver     = 3.8.7
facter           = 2.4.4
puppetdb         = 2.3.8-1

In my puppet.conf on the clients and server i have included:

stringify_facts  = false

In my site.pp i have following entry:

  if is_hash($::os) {
    notify {'hash':}
    notify {$os['family']:}
    }

    if is_string($::os) {
    notify {'string':}
    notify {$os['family']:}
    }

If in my puppet.conf on the Server:

storeconfigs          = true
storeconfigs_backend  = puppetdb

and the puppetdb is running.

I get the following message on the Client puppetrun:

os is not a hash or Array when accesssing it with family.

If i changed my site.pp to only:

  if is_string($::os) {
    notify {'os is a string':}
  }

Then i get the message -> 'os is a string'

If i change the puppet.conf on my server to:

storeconfigs          = false
storeconfigs_backend  = puppetdb

then all is ok. os fact will identified as a hash.

Has anyone a idea? Please help :) Taner

Matthew Schuchard
  • 25,172
  • 3
  • 47
  • 67
mobios
  • 353
  • 1
  • 2
  • 7
  • I am assuming from `is_hash` that you are using `puppetlabs-stdlib`, correct? I thought intrinsic facts were not hashes in general with Facter < 3.0. Also, this probably has no effect, but why are you switching from os global (`$::os`) to os local (`$os`) in your `site.pp`? – Matthew Schuchard Jun 10 '16 at 11:07
  • Thanks for the answer. – mobios Jun 10 '16 at 11:46
  • Thanks for the answer Matt . $::os and $os is in my manifest the same toplevel variable os. I have no localscope variables in this example. Yes you are wright the methode "is_hash" is from puppetlabs-stdlib. Since facter 2.0 facter can handle structured facts see here https://docs.puppet.com/facter/2.2/fact_overview.html#writing-structured-facts. And in my problem if i deactivate the puppetdb all is fine :(. os will be identified as a hash. – mobios Jun 10 '16 at 11:56
  • If i simple try this: `if $os['family'] == 'windows' { notify {'windows':}}` i get the same error like described above -> os is not a hash or Array when accesssing it with family. – mobios Jun 10 '16 at 12:07
  • OK I figured it out. Answering now. – Matthew Schuchard Jun 10 '16 at 14:54

0 Answers0