Re: [Puppet Users] Need Ruby help for facts (inline_template) --> <%= classes.collect { |k, v| v }.sort.join(" ") %> --> empty

2017-04-18 Thread Denny Fuchs

hi,

I've found the reason. The class profile::icinga2::agent must be loaded 
after all other classes. Than I get all classes from the node back.

cu denny

-- 
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/215688c3-159a-4ee7-98be-96d940577989%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Need Ruby help for facts (inline_template) --> <%= classes.collect { |k, v| v }.sort.join(" ") %> --> empty

2017-04-17 Thread Denny Fuchs
hi,

what is very interesting:

If I'm go back to my old 

  vars=> hiera_hash('icinga_vars', {}),

and adding to hieradata/common.yaml 

  puppet_classes: "%{::classes}"

than I get back all classes, but with the "["  "]" 

 vars.puppet_classes = "["settings",  "augeas::files"]"

So, it seems, that only the classes are listed, which are from the manifest 
of my class "profile::icinga2::agent", which is included via "include 
profile::icinga2::agent" in the node manifest.

cu denny

-- 
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/d5381c79-6c11-44ce-8056-6a309a45deaf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Need Ruby help for facts (inline_template) --> <%= classes.collect { |k, v| v }.sort.join(" ") %> --> empty

2017-04-17 Thread Denny Fuchs

hi Derek,


Am Montag, 17. April 2017 21:50:37 UTC+2 schrieb Derek Harkness:
>
> In your example it looks like classes is an array not a hash.  Should be 
> able to just do classes.join(“ “).
>
> Derek
>
>
I tried it, as the "module" example uses only  .join. It works only for a 
few classes (13 in numbers):

+  vars.puppet_classes = "base::root::password host.domain.local icinga2 
icinga2::config icinga2::feature::api icinga2::feature::checker 
icinga2::feature::mainlog icinga2::install icinga2::params icinga2::repo 
icinga2::service profile::icinga2::agent settings"

but 

facter -p classes --yaml | wc -l
96

so I have over 90 classes which are not shown. Very strange. Is there a 
limit ?

cu denny

-- 
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/aac02373-1bc3-4e03-8cd0-328aaba9029c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Need Ruby help for facts (inline_template) --> <%= classes.collect { |k, v| v }.sort.join(" ") %> --> empty

2017-04-17 Thread Derek Harkness
In your example it looks like classes is an array not a hash.  Should be able 
to just do classes.join(“ “).

Derek

> On Apr 17, 2017, at 00:46, Denny Fuchs  wrote:
> 
> Hello,
> 
> for my Icinga2, I want to add all classes to vars, like described in 
> https://goo.gl/z798HG (page 41). I added the sjoeboo/puppet-common module, 
> which gives me all classes as a fact:
> 
> facter -p classes
> ["settings", "host.foo.local", "base::root::password", "icinga2::params", 
> "icinga2", ... ]
> 
> facter -p classes  --yaml
> ---
>   classes:
> - settings
> - host.foo.local
> - "base::root::password"
> - "icinga2::params"
> - icinga2
> 
> I tried the line:
> 
> [...]
> puppet_classes => inline_template(
> '<%= classes.collect { |k, v| v }.sort.join(" ") %>'
> ),
> [...]
> 
> so that in the end...
> 
> vars.settings
> vars.host.foo.local
> vars.base
> vars.icinga2
> 
> is generated for the Icinga2 monitoring host. But in my case, the following 
> is generated instead:
> 
> +  vars.puppet_classes = ""
> 
> 
> Maybe, the howto is a bit older and the syntax was changed a bit. We use the 
> Puppet 3.7.2-4 agent.
> 
> Any suggestions are very welcome :-)
> 
> cu denny
> 
> -- 
> 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/d20e6894-1379-4039-855d-9babfa447be6%40googlegroups.com
>  
> .
> 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/ED56A543-44E0-44F6-AC46-4008B78DA0E2%40mac.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Need Ruby help for facts (inline_template) --> <%= classes.collect { |k, v| v }.sort.join(" ") %> --> empty

2017-04-17 Thread Denny Fuchs
Hello,

for my Icinga2, I want to add all classes to vars, like described in 
https://goo.gl/z798HG (page 41). I added the sjoeboo/puppet-common module, 
which gives me all classes as a fact:

facter -p classes
["settings", "host.foo.local", "base::root::password", "icinga2::params", 
"icinga2", ... ]

facter -p classes  --yaml
---
  classes:
- settings
- host.foo.local
- "base::root::password"
- "icinga2::params"
- icinga2

I tried the line:

[...]
puppet_classes => inline_template(
'<%= classes.collect { |k, v| v }.sort.join(" ") %>'
),
[...]

so that in the end...

vars.settings
vars.host.foo.local
vars.base
vars.icinga2

is generated for the Icinga2 monitoring host. But in my case, the following 
is generated instead:

+  vars.puppet_classes = ""


Maybe, the howto is a bit older and the syntax was changed a bit. We use 
the Puppet 3.7.2-4 agent.

Any suggestions are very welcome :-)

cu denny

-- 
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/d20e6894-1379-4039-855d-9babfa447be6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.