Re: [Puppet Users] Array of properties matching_all not working

2016-12-05 Thread Stefan Schulte


On 04.12.2016 09:27, Lupin Deterd wrote:
> Hi,
>
>  I'm working on a custom type & provider. One of the property is an
> Array and I want to match every elements in it but somehow I can't
> make it work. Relevant snippet are as follow:
>
> type/zfsacl.rb
>
>   newproperty(:permission, :array => :matching_all) do

I think this should read

:array_matching => :all

instead of

:array => :matching_all

- Stefan

-- 
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/67a5b890-9fbc-9d94-dfa8-92b3ad1c05a2%40posteo.de.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Puppet lookup() default value

2016-12-05 Thread Jonathan Gazeley
In my old Puppet+Hiera install, there was a variable 'ilom' defined for 
some nodes in my estate, but not all. I used to handle it like this:


$ilom = hiera('ilom', undef)

if ($ilom) {
  $ilomnotes = "iLOM address: ${ilom}"
} else {
  $ilomnotes = undef
}

@@nagios_host { $::fqdn:
  ...
  notes   => $ilomnotes,
  ...
}

The new lookup() function doesn't work in the same way. What's the 
recommended way of referencing a variable that may or may not exist?


I'm still getting used to new Hiera as I'm building my replacement 
server and I've got a lot of legacy baggage :(


Thanks,
Jonathan

--
Jonathan Gazeley
Senior Systems Administrator
IT Services
University of Bristol

--
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/07ed6cb6-a217-106c-9548-a7b6bbc01f3d%40bristol.ac.uk.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] hiera & profile & roles

2016-12-05 Thread Albert Shih
 Le 16/11/2016 à 10:51:39+0100, Craig Dunn a écrit

Hi,

> > class { "my_application":
> >   tomcat_root => $::tomcat::catalina_home
> > }
>
> SUPER nice.
>
> I didn't think about that
>
> Don't know why but I always thought that was « bad practice » to access
> some attribute from outside the module.
>
>
> Not at all - especially not when done from the profiles.
>
> A module's attributes are effectively it's API - by accessing
> $::tomcat::catalina_home you don't need to know or care if the value is being
> set by hiera or by the modules default (params.pp), and it's the best source 
> of
> truth for that value.  This is a very good example of the benefits of profiles
> too.

Is they are any equivalent about ressources create by « define ». For
example I would like to get all vhost create by

  apache::vhost

in some supervision module.

I try

  $::apache::vhost

and didn't work.

The purpose is to automatically create supervision of each vhost by

  class apache_supervision {

$vhost_hash = $::apache::vhost
$vhost_hash.each | String $site_name, $Hash $site_info |
etc.
}

Regards.


NB: I answer to a old post, hope that's not against some rule...

--
Albert SHIH
DIO bâtiment 15
Observatoire de Paris
5 Place Jules Janssen
92195 Meudon Cedex
France
Téléphone : +33 1 45 07 76 26/+33 6 86 69 95 71
xmpp: j...@obspm.fr
Heure local/Local time:
lun 5 déc 2016 16:07:23 CET

-- 
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/20161205150820.GL14188%40pcjas.obspm.fr.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Error while spec testing -- missing collect?

2016-12-05 Thread Peter Berghold
The piece of Puppet code the spec testing is complaining about is here:

--8< snip
8<-

  $servers = ntp_unpackservers(
query_facts("is_ntp_server=true and sitename = ${sitename}",'ipaddress')
  )

--8< snip
8<-

and the error I'm seeing is:

--8< snip
8<-

 Puppet::Error:
   undefined method `collect' for "ipaddress":String at /home//puppet-module-src/ntp/spec/fixtures/modules/ntp/manifests/client.pp:8
on node redacted

--8< snip
8<-

so the question is what defines "collect?"

The code sniglet is a query of PuppetDB that works well in our test and
production environments but I'm having issues trying to convince RSpec it's
working.

Thoughts? Suggestions?

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


Re: [Puppet Users] Error while spec testing -- missing collect?

2016-12-05 Thread Rob Nelson
The error is in the function query_facts, or code that it calls. Puppet is
not great about reporting on a Ruby code failure called from the puppet DSL.

I couldn't tell you the actual cause but if you look wherever that function
is defined you may see a collect statement and that should guide you. My
guess is that some fact it relies on wasn't mocked (well) and is returning
nil, thus there is no .collect method on nil.

On Mon, Dec 5, 2016 at 5:25 PM Peter Berghold 
wrote:

> The piece of Puppet code the spec testing is complaining about is here:
>
> --8< snip
> 8<-
>
>   $servers = ntp_unpackservers(
> query_facts("is_ntp_server=true and sitename =
> ${sitename}",'ipaddress')
>   )
>
> --8< snip
> 8<-
>
> and the error I'm seeing is:
>
> --8< snip
> 8<-
>
>  Puppet::Error:
>undefined method `collect' for "ipaddress":String at /home/ account>/puppet-module-src/ntp/spec/fixtures/modules/ntp/manifests/client.pp:8
> on node redacted
>
> --8< snip
> 8<-
>
> so the question is what defines "collect?"
>
> The code sniglet is a query of PuppetDB that works well in our test and
> production environments but I'm having issues trying to convince RSpec it's
> working.
>
> Thoughts? Suggestions?
>
> --
> 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/CAArvnv3ivnqNoQk2dFzuD3YYpy4p9YBY_XpCZUgc2wTT4vNsWA%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
-- 
Rob Nelson

-- 
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/CAC76iT8F4vS4BTvP5XV%3DO93hY3aFT-fb3wEQ%3DyaJrO3K8BK-bw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Error while spec testing -- missing collect?

2016-12-05 Thread Peter Berghold
Give the man a cigar.  As soon as I mocked up "ipaddress" it was happy.
Don't know why I didn't see that


On Mon, Dec 5, 2016 at 12:43 PM Rob Nelson  wrote:

> The error is in the function query_facts, or code that it calls. Puppet is
> not great about reporting on a Ruby code failure called from the puppet DSL.
>
> I couldn't tell you the actual cause but if you look wherever that
> function is defined you may see a collect statement and that should guide
> you. My guess is that some fact it relies on wasn't mocked (well) and is
> returning nil, thus there is no .collect method on nil.
>
> On Mon, Dec 5, 2016 at 5:25 PM Peter Berghold 
> wrote:
>
> The piece of Puppet code the spec testing is complaining about is here:
>
> --8< snip
> 8<-
>
>   $servers = ntp_unpackservers(
> query_facts("is_ntp_server=true and sitename =
> ${sitename}",'ipaddress')
>   )
>
> --8< snip
> 8<-
>
> and the error I'm seeing is:
>
> --8< snip
> 8<-
>
>  Puppet::Error:
>undefined method `collect' for "ipaddress":String at /home/ account>/puppet-module-src/ntp/spec/fixtures/modules/ntp/manifests/client.pp:8
> on node redacted
>
> --8< snip
> 8<-
>
> so the question is what defines "collect?"
>
> The code sniglet is a query of PuppetDB that works well in our test and
> production environments but I'm having issues trying to convince RSpec it's
> working.
>
> Thoughts? Suggestions?
>
> --
> 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/CAArvnv3ivnqNoQk2dFzuD3YYpy4p9YBY_XpCZUgc2wTT4vNsWA%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
> --
> Rob Nelson
>
> --
> 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/CAC76iT8F4vS4BTvP5XV%3DO93hY3aFT-fb3wEQ%3DyaJrO3K8BK-bw%40mail.gmail.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/CAArvnv3WRpaQn8LK0dWDVZZETc8ax%3D1MZOq%2BfL-VKU6PteKwRA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Error while spec testing -- missing collect?

2016-12-05 Thread Rob Nelson
You may want to look into https://github.com/mcanevet/rspec-puppet-facts as
this has bit me in the behind more than once until I made the switch. The
readme is a pretty good guide to get started, and I wrote a little bit on
doing OS/kernel specific tests with it at
https://rnelson0.com/2016/11/04/puppet-tech-debt-day-3-excluding-os-testing/,
important if you support say linux and windows. I need to write another
article that's a little more complete on the setup, but if you have
questions, ask away. Pretty sure mcanevet is around here, too.


Rob Nelson
rnels...@gmail.com

On Mon, Dec 5, 2016 at 1:16 PM, Peter Berghold 
wrote:

> Give the man a cigar.  As soon as I mocked up "ipaddress" it was happy.
> Don't know why I didn't see that
>
>
> On Mon, Dec 5, 2016 at 12:43 PM Rob Nelson  wrote:
>
>> The error is in the function query_facts, or code that it calls. Puppet
>> is not great about reporting on a Ruby code failure called from the puppet
>> DSL.
>>
>> I couldn't tell you the actual cause but if you look wherever that
>> function is defined you may see a collect statement and that should guide
>> you. My guess is that some fact it relies on wasn't mocked (well) and is
>> returning nil, thus there is no .collect method on nil.
>>
>> On Mon, Dec 5, 2016 at 5:25 PM Peter Berghold 
>> wrote:
>>
>> The piece of Puppet code the spec testing is complaining about is here:
>>
>> --8< snip 8<
>> -
>>
>>   $servers = ntp_unpackservers(
>> query_facts("is_ntp_server=true and sitename =
>> ${sitename}",'ipaddress')
>>   )
>>
>> --8< snip 8<
>> -
>>
>> and the error I'm seeing is:
>>
>> --8< snip 8<
>> -
>>
>>  Puppet::Error:
>>undefined method `collect' for "ipaddress":String at /home/> account>/puppet-module-src/ntp/spec/fixtures/modules/ntp/manifests/client.pp:8
>> on node redacted
>>
>> --8< snip 8<
>> -
>>
>> so the question is what defines "collect?"
>>
>> The code sniglet is a query of PuppetDB that works well in our test and
>> production environments but I'm having issues trying to convince RSpec it's
>> working.
>>
>> Thoughts? Suggestions?
>>
>> --
>> 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/CAArvnv3ivnqNoQk2dFzuD3YYpy4p9
>> YBY_XpCZUgc2wTT4vNsWA%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> Rob Nelson
>>
>> --
>> 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/CAC76iT8F4vS4BTvP5XV%3DO93hY3aFT-fb3wEQ%
>> 3DyaJrO3K8BK-bw%40mail.gmail.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/CAArvnv3WRpaQn8LK0dWDVZZETc8ax
> %3D1MZOq%2BfL-VKU6PteKwRA%40mail.gmail.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/CAC76iT8vNQqXswYoNuxWwzqOK%3DgbNeo%2Bt-qy9DBUWFhTaUUADQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Array of properties matching_all not working

2016-12-05 Thread Lupin Deterd
Spot on. Thank you very much.

On Mon, Dec 5, 2016 at 11:46 AM, Stefan Schulte  wrote:

>
>
> On 04.12.2016 09:27, Lupin Deterd wrote:
> > Hi,
> >
> >  I'm working on a custom type & provider. One of the property is an
> > Array and I want to match every elements in it but somehow I can't
> > make it work. Relevant snippet are as follow:
> >
> > type/zfsacl.rb
> >
> >   newproperty(:permission, :array => :matching_all) do
>
> I think this should read
>
> :array_matching => :all
>
> instead of
>
> :array => :matching_all
>
> - Stefan
>
> --
> 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/67a5b890-9fbc-9d94-dfa8-92b3ad1c05a2%40posteo.de.
> 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/CAL0mBkRqqohFvtSWQddL6Y_ioB1f_pwKfx8Ts_qUiGsqfbxK-g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.