I'm relatively new to puppet but I used hiera_hash to lookup what I would consider a "hash" in yaml.
The data I tested with is rather complex in nature but it basically boils down to a hash of hashes with sub hashes / arrays. Ex: (my hieradata yaml file, pardon the lack of creativity in the names) stuff: FirstNamedStuff: foo: bar foo2: - bara - barb foo3: anotherthing: hi yetanotherthing: hi2 Puppet (v4.3.2) is returning it as a struct (ex: Struct[{FirstNamedStuff => Struct[] }] ) when I was expecting it to be returned as a hash. I'm using functions written in puppet (not be confused with puppet functions written in ruby which if you google is what you'll get mostly) with type information for my parameter. I pass in this value gotten from hiera_hash("stuff") to my custom function but it fails because it expected a hash and instead received a struct. Ex: function module::get_foo(Hash[String, Struct[{ foo => String, foo2 => Array[String] foo3 => Hash[String, String] }] $myvar) { } I think what's happening is hiera is *always* being treated as a struct for any hash. I assumed they were interchangeable but it doesn't look like they are. There are some cases where I want to enforce a hash, there are other cases where I want to enforce a struct. Ex: FirstNameStuff for instance might be user defined, it could be anything. But foo, foo2, foo3 are all properties that I expect and so a struct makes sense. foo3's properties might be userdefined so a hash makes sense. So the question is, can I somehow get this functionality from hieradata and a custom function? Maybe this is just a bug with 4.3.2? Or is my only hope to strip off the type information? -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/21d19acd-b054-41eb-9c56-da1d6c6bfd44%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.