Re: [Puppet Users] Re: hiera style guide

2017-10-06 Thread Henrik Lindberg

On 06/10/17 09:11, Michael Watters wrote:

You do not *have* to quote strings however I have ran into issues with hiera 
turning strings that look like integers into an integer which causes problems 
when you attempt to do a key lookup using a string value or pass a value to a 
parameter that expects a string value.

For example, there is a difference between this:

|
signing_keys:
     epel:'7':
         key_name:foo
|


And this:

|
signing_keys:
     epel:7:
         key_name:foo
|


The latter causes the value for signingkeys['epel'] to be converted into 
an integer instead of a string.  This can cause issues with puppet 
depending on how you reference the data.




Note that it is not "hiera"/"puppet" that does that, it is the parser 
that reads json or yaml that lexes and interprets values as array, hash, 
string, integer etc. according with the syntax and rules for the format.


- henrik



On Thursday, September 28, 2017 at 12:44:05 PM UTC-4, Georg Faerber wrote:

Hi all,

Searching the Internets didn't reveal anything: Is there some style
guide or best practice regarding syntax used in hiera, writing .yaml
files? For example, should it be:

array:
   - string
   - string

or

array:
   - 'string'
   - 'string'

Thanks in advance,
all the best,
Georg

--
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/300854eb-2727-4299-93ec-189fae953ddf%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.



--

Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/

--
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/or8vh9%242te%242%40blaine.gmane.org.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: hiera style guide

2017-10-06 Thread Michael Watters


You do not *have* to quote strings however I have ran into issues with hiera 
turning strings that look like integers into an integer which causes problems 
when you attempt to do a key lookup using a string value or pass a value to a 
parameter that expects a string value.

For example, there is a difference between this:

signing_keys:
epel: '7':
key_name: foo 


And this:

signing_keys:
epel: 7:
key_name: foo

The latter causes the value for signingkeys['epel'] to be converted into an 
integer instead of a string.  This can cause issues with puppet depending 
on how you reference the data.


On Thursday, September 28, 2017 at 12:44:05 PM UTC-4, Georg Faerber wrote:
>
> Hi all, 
>
> Searching the Internets didn't reveal anything: Is there some style 
> guide or best practice regarding syntax used in hiera, writing .yaml 
> files? For example, should it be: 
>
> array: 
>   - string 
>   - string 
>
> or 
>
> array: 
>   - 'string' 
>   - 'string' 
>
> Thanks in advance, 
> all the best, 
> Georg 
>

-- 
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/300854eb-2727-4299-93ec-189fae953ddf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.