Hey John, I've just found out that notice() gives back the array indeed.
Thanks for clarifying that, I didn't know this until now and was really confused :) Best, Rp On Thu, Sep 28, 2017 at 3:02 PM, jcbollinger <[email protected]> wrote: > > > On Thursday, September 28, 2017 at 5:49:12 AM UTC-5, Robert wrote: >> >> Eh, sorry. >> >> So why's this with the above code: >> >> Notice: /Stage[main]/Main/Notify[sdf]/message: defined 'message' as '1' >> and keys($hash) gives 'a' >> >> Why not arrays of the keys / values? Can't understand. >> > > Although it is not explicitly spelled out in the docs, it should not be > much of a surprise that the Notify type expects its 'message' parameter > ("The message to be sent to the log") to be a string. When you provide an > array instead, Notify must either reject it with an error, or convert the > array to a string by some unspecified mechanism. In the version of Puppet > you are running, it opts in such cases to convert the array to a string by > choosing its first element (not necessarily recursively). I'm uncertain > whether this is intentional behavior or simply what happens to fall out > from the implementation in this particular variation on providing a value > of the wrong type. > > If you want to control how the arrays you're working with are converted to > strings, then you ought to perform the conversion explicitly > <https://docs.puppet.com/4.10/function.html#array--tuple-to-string>, > Details vary to some extent based on what Puppet version you are using (the > link goes to the docs for Puppet 4). > > > John > > -- > 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 [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/puppet-users/e08aedc0-f6f7-46de-b634-c2b2ceb76fbb%40googlegroups.com > <https://groups.google.com/d/msgid/puppet-users/e08aedc0-f6f7-46de-b634-c2b2ceb76fbb%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CANwwCtyXuWuGajtgoYwOrES8Y4W5m0%2BDrAuo2%3D2ueUW3t6askQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
