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.


Re: [Puppet Users] ERB variable scope

2017-10-06 Thread Henrik Lindberg

On 06/10/17 11:28, Daniel Urist wrote:
I've noticed in classes with multiple templates that ERB variables seem 
to share a single scope. That caught me by surprise-- is that intended 
behavior?




Intended or not - that is the behavior, and this is Ruby so it is 
possible to mutate things that should be immutable.


There is great responsibility when writing code in ERB because of the 
generality and power available in Ruby. Suggest using EPP instead where 
problems like this one does not occur.


Best,
- henrik


Here's a simple test case:

class erb_scope_test (
)
{
   $myarr1 = [ 'one' ]
   $myarr2 = [ 'two' ]

   $str1 = inline_template("<%= @myarr1.concat(@myarr2) %>")
   notify { $str1: }

   $str2 = inline_template("<%= @myarr1.concat(@myarr2) %>")
   notify { $str2: }
}

Notice: ["one", "two"]
Notice: ["one", "two", "two"]

--
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/CAEo6%3DKbd8wMO9rvzHMe4W-bo%2BizqLxyAyEf4ThWScOAgpL%2BkdA%40mail.gmail.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/or8vca%242te%241%40blaine.gmane.org.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] ERB variable scope

2017-10-06 Thread Daniel Urist
I've noticed in classes with multiple templates that ERB variables seem to
share a single scope. That caught me by surprise-- is that intended
behavior?

Here's a simple test case:

class erb_scope_test (
)
{
  $myarr1 = [ 'one' ]
  $myarr2 = [ 'two' ]

  $str1 = inline_template("<%= @myarr1.concat(@myarr2) %>")
  notify { $str1: }

  $str2 = inline_template("<%= @myarr1.concat(@myarr2) %>")
  notify { $str2: }
}

Notice: ["one", "two"]
Notice: ["one", "two", "two"]

-- 
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/CAEo6%3DKbd8wMO9rvzHMe4W-bo%2BizqLxyAyEf4ThWScOAgpL%2BkdA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: puppetdb 4.3 on PG 9.4 fresh install fails to start with DB UTF8 encoding error

2017-10-06 Thread Ben West
I encountered this very same problem installing puppetDB v4.4 from RPM on 
CentOS 7.2.1511, with postgres v9.4 installed via RPMs retrieved from 
yum.postgresql.org.

I tried following the instructions here for creating the puppetdb role and 
database in postgresql:
https://docs.puppet.com/puppetdb/4.4/configure.html#using-postgresql

Nevertheless, pointing the puppetdb service to this blank database and 
starting it up yielded this same (persistent) error in puppetdb.log, quoted 
below.

A resolution I found was to pg_restore a backup from another instance of 
puppetdb, and then restart puppetdb again.  That is, the problem appears to 
be limited to populating the postgres database on first startup.

2017-10-06 17:28:42,627 INFO  [p.p.s.migrate] Applying database migration 
version 28
2017-10-06 17:28:43,153 INFO  [p.p.s.migrate] Applying database migration 
version 29
2017-10-06 17:28:43,564 INFO  [p.p.s.migrate] Applying database migration 
version 30
2017-10-06 17:28:43,571 INFO  [p.p.s.migrate] Applying database migration 
version 31
2017-10-06 17:28:43,586 INFO  [p.p.s.migrate] Applying database migration 
version 32
2017-10-06 17:28:43,589 INFO  [p.p.s.migrate] Applying database migration 
version 33
2017-10-06 17:28:43,611 INFO  [p.p.s.migrate] Applying database migration 
version 34
2017-10-06 17:28:43,632 INFO  [p.p.s.migrate] Applying database migration 
version 35
2017-10-06 17:28:43,633 INFO  [p.p.s.migrate] Applying database migration 
version 36
2017-10-06 17:28:43,635 INFO  [p.p.s.migrate] Applying database migration 
version 37
2017-10-06 17:28:43,637 INFO  [p.p.s.migrate] Applying database migration 
version 38
2017-10-06 17:28:43,647 INFO  [p.p.s.migrate] Applying database migration 
version 39
2017-10-06 17:28:43,791 INFO  [p.p.s.migrate] Applying database migration 
version 40
2017-10-06 17:28:43,803 INFO  [p.p.s.migrate] Applying database migration 
version 41
2017-10-06 17:28:43,804 INFO  [p.p.s.migrate] Applying database migration 
version 42
2017-10-06 17:28:43,840 INFO  [p.p.s.migrate] Applying database migration 
version 43
2017-10-06 17:28:43,853 ERROR [p.p.s.migrate] Caught SQLException during 
migration
java.sql.BatchUpdateException: Batch entry 1 CREATE AGGREGATE md5_agg 
(BYTEA)
(
  sfunc = dual_md5,
  stype = bytea,
  initcond = '\x00'
) was aborted.  Call getNextException to see the cause.
at 
org.postgresql.jdbc.BatchResultHandler.handleError(BatchResultHandler.java:133)
at 
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2004)
at 
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:360)
at org.postgresql.jdbc.PgStatement.executeBatch(PgStatement.java:1019)
at 
com.zaxxer.hikari.pool.ProxyStatement.executeBatch(ProxyStatement.java:128)
at 
com.zaxxer.hikari.pool.HikariProxyStatement.executeBatch(HikariProxyStatement.java)
at clojure.java.jdbc$execute_batch.invokeStatic(jdbc.clj:439)
at clojure.java.jdbc$execute_batch.invoke(jdbc.clj:432)
at clojure.java.jdbc$db_do_commands$fn__21807.invoke(jdbc.clj:748)
at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:662)
at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:598)
at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:611)
at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:598)
at clojure.java.jdbc$db_do_commands.invokeStatic(jdbc.clj:747)
at clojure.java.jdbc$db_do_commands.invoke(jdbc.clj:732)
at puppetlabs.puppetdb.jdbc$do_commands.invokeStatic(jdbc.clj:38)
at puppetlabs.puppetdb.jdbc$do_commands.doInvoke(jdbc.clj:33)
at clojure.lang.RestFn.invoke(RestFn.java:436)
at 
puppetlabs.puppetdb.scf.migrate$add_indexes_for_reports_summary_query.invokeStatic(migrate.clj:900)
at 
puppetlabs.puppetdb.scf.migrate$add_indexes_for_reports_summary_query.invoke(migrate.clj:898)
at 
puppetlabs.puppetdb.scf.migrate$migrate_BANG_$fn__35954$fn__35963.invoke(migrate.clj:1400)
at 
puppetlabs.puppetdb.scf.migrate$sql_or_die.invokeStatic(migrate.clj:1343)
at puppetlabs.puppetdb.scf.migrate$sql_or_die.invoke(migrate.clj:1334)
at 
puppetlabs.puppetdb.scf.migrate$migrate_BANG_$fn__35954.invoke(migrate.clj:1400)
at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:628)
at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:598)
at 
puppetlabs.puppetdb.scf.migrate$migrate_BANG_.invokeStatic(migrate.clj:1397)
at 
puppetlabs.puppetdb.scf.migrate$migrate_BANG_.invoke(migrate.clj:1367)
at 
puppetlabs.puppetdb.cli.services$initialize_schema.invokeStatic(services.clj:293)
at 
puppetlabs.puppetdb.cli.services$initialize_schema.invoke(services.clj:284)
at 
puppetlabs.puppetdb.cli.services$init_with_db$fn__36175.invoke(services.clj:316)
at 
puppetlabs.puppetdb.cli.services$init_with_db.invokeStatic(services.clj:312)
at 
puppetlabs.puppetdb.cli.services$init_with_db.invoke(services.clj:297)
at 

[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.


Re: [Puppet Users] PuppetServer 2.8 resource Leak

2017-10-06 Thread Poil
Hi,

The database connections leak remains after upgrading trocla. 
Also after 2 days the catalog computation times start to increase again.
I'm going to install newrelic on a puppetserver and if I see nothing I will try 
to analyze via your blog article. 

Best regardsLe 4 oct. 2017 10:58, Poil  a écrit :
>
> Hi, 
>
> Thanks ! 
>
> We had Trocla 0.2.3, and module 0.2.2 I'm upgrading to Trocla 0.3.0 and 
> latest module code 
>
> Best regards, 
>
>
> Le 04/10/2017 à 08:27, Peter Meier a écrit : 
> >> We are on hiera v3, we only tuned  "max-requests-per-instance: 5000" 
> >> because of a databases connection leak with our Trocla library. 
> > This is fixed with the trocla module 1.0.1 [1] are you on that version? 
> > 
> > best 
> > 
> > ~pete 
> > 
> > [1] 
> > https://github.com/duritong/puppet-trocla/commit/bbedb788a7951e2f69c1c2815a5c3c669ff02ae6
> >  
> > 
>
> -- 
> 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/675be630-3ef4-e316-6d05-d6000eaadd6c%40quake.fr.
>  
> 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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/201710061040.v96AePwT024560%40smtp5.infomaniak.ch.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Usage of server_list multiple masters

2017-10-06 Thread Jayapandian Ponraj
Hi

how to use the option "server_list" which is available in puppet 4.6?
https://docs.puppet.com/puppet/4.6/release_notes.html#specify-multiple-masters-with-serverlist-option

I tried with two different puppet server instances and i am facing 
certificate issues when the active/first server fails..

Any documentation available of how to setup the secondary master?
I have doubts as to what should be the "dns_alt_names" and how the second 
master finds the ca certificates.

I followed this doc 
https://docs.puppet.com/puppet/3/scaling_multiple_masters.html

-- 
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/6ed98b0e-3bc9-4f87-9ef3-6b2f517cc436%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Puppet Feature Request (lookup with keys containing ".")

2017-10-06 Thread Craig Dunn
Apologies, I didn't spot the extra quotes (or read properly what you said
about them)  I clearly need more coffee... Yes, that does work...

---
"foo.bar.tango": bar


$bar = lookup("'foo.bar.tango'")
notify { $bar: }


Notice: /Stage[main]/Main/Notify[bar]/message: defined 'message' as 'bar'



On Fri, Oct 6, 2017 at 9:35 AM, Craig Dunn  wrote:

>
>
> On Thu, Oct 5, 2017 at 6:44 PM, Henrik Lindberg <
> henrik.lindb...@puppet.com> wrote:
>
>> On 04/10/17 08:54, John Baird wrote:
>>
>>>
>>> Something like "lookup('/path/to/somefile.txt', scope=false)"... In
>>> this manner, the user and more specifically, each lookup call can determine
>>> whether or not to include the dotted key.
>>>
>>>
>> You get what you want if you quote the entire key.
>>
>>   lookup("'/path/to/somefile.txt'")
>>
>> Note the quotes inside of the string. In lookup any quoted part is taken
>> verbatim and will not be subject to interpretation as a 'dig' into the
>> value being looked up.
>>
>> - henrik
>>
>>
> Hi Henrik.
>
> This is not the behaviour that I see.   The fact that interpolated strings
> still dig is actually useful for dynamically digging into hashes, that
> doesn't help the OP though.
>
> [root@puppet hieradata]# cat common.yaml
> ---
>
> foo:
>   bar:
> tango: delta
>
> [root@puppet hieradata]# puppet apply -e 'notify {
> *lookup("foo.bar.tango")*: }'
> ...
> Notice: delta
> Notice: /Stage[main]/Main/Notify[delta]/message: defined 'message' as
> 'delta'
>
> Regards
> Craig
>
>
>


-- 
Enviatics |  Automation and Configuration Management
Puppet Labs Service Delivery Partner & Certified Consultant
http://www.enviatics.com | @Enviatics | cr...@enviatics.com

-- 
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/CACxdKhEmHhf7aYAe37wUYCxesrBSCka84ARQSHyX73PAtrn%3DGw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Puppet Feature Request (lookup with keys containing ".")

2017-10-06 Thread Craig Dunn
On Thu, Oct 5, 2017 at 6:44 PM, Henrik Lindberg 
wrote:

> On 04/10/17 08:54, John Baird wrote:
>
>>
>> Something like "lookup('/path/to/somefile.txt', scope=false)"... In this
>> manner, the user and more specifically, each lookup call can determine
>> whether or not to include the dotted key.
>>
>>
> You get what you want if you quote the entire key.
>
>   lookup("'/path/to/somefile.txt'")
>
> Note the quotes inside of the string. In lookup any quoted part is taken
> verbatim and will not be subject to interpretation as a 'dig' into the
> value being looked up.
>
> - henrik
>
>
Hi Henrik.

This is not the behaviour that I see.   The fact that interpolated strings
still dig is actually useful for dynamically digging into hashes, that
doesn't help the OP though.

[root@puppet hieradata]# cat common.yaml
---

foo:
  bar:
tango: delta

[root@puppet hieradata]# puppet apply -e 'notify { *lookup("foo.bar.tango")*:
}'
...
Notice: delta
Notice: /Stage[main]/Main/Notify[delta]/message: defined 'message' as
'delta'

Regards
Craig

-- 
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/CACxdKhHE07-1TT-oHJ5Ux2t_5fpiN6TAk4noewFnweSvO0T9bw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.