[Puppet Users] Code coverage for puppet resources

2014-01-26 Thread Gareth Rushgrove
For anyone else who likes writing tests for their puppet manifests,
I've just added basic code coverage to rspec-puppet:

A blog post here about how to use it:

http://www.morethanseven.net/2014/01/25/code-coverage-for-puppet-modules/

I'd be interested in any feedback on how to improve or add to this.

Cheers

Gareth

-- 
Gareth Rushgrove
@garethr

devopsweekly.com
morethanseven.net
garethrushgrove.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/CAFi_6yLzEYJ4vbMh28PwoHoYwtGGTnfpra16TnoGrFuGqyGuSg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] Hash and loops

2014-01-26 Thread Thomas Bendler
Hi @all,

I try to pass a hash to a module class like this:

class { 'modulename':
  filecontent => {
name1 => 'value1',
name2 => 'value2',
...
namex => 'valuex',
  }
}

​The class should take the hash list, loop over the list and create i.e.
file resources with namex and content valuex. What is the best way to do
this and, even more important, is it possible to do something like this?

Regards Thomas​
-- 
Linux ... enjoy the ride!

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


[Puppet Users] Hash and loops

2014-01-26 Thread Jose Luis Ledesma
Hello,

You should look the create_resources:

http://docs.puppetlabs.com/references/latest/function.html#createresources

Regards,

-- 
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/a7f77bab-122a-47d5-ad7e-df152f32f152%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] Re: Composite namevars for custom Type

2014-01-26 Thread badgerious
Len,

I tried out your code, and it looks good (the resource in the puppet 
manifest doesn't conform to the title pattern format, which causes a 
different error, but the title_patterns method itself is being recognized). 
I'd try restarting the puppetmaster. I've found this to be necessary when 
making changes to types. 

Eric

On Saturday, January 25, 2014 10:20:46 PM UTC-6, Len wrote:
>
> John,
>
> Thanks for the link. What I think is happening, is that I am not 
> overloading the title_patterns function/method correctly. I've followed 
> some other examples I came across, including the one in the link. But it 
> does not seem to be picking up the def self.title_patterns from the custom 
> type. And I'm still learning ruby and the inner workings of puppet.
>
> Len
>  
>
> On Saturday, January 25, 2014 12:08:18 PM UTC-5, Len wrote:
>>
>>
>> Jan 23
>> To all,
>>
>> I am on puppet 2.7.3 and I'm working on a custom RabbitMQ type, that will 
>> use composite namevar.  I did not see any work out there already for 
>> managing rabbitMQ bindings so I've started on one and I'm running into 
>> problems with the composite namevar. I have a very basic type ( below ) but 
>> when I run the puppet as an agent I still get the error "Error 400 on 
>> SERVER: Could not render to pson: you must specify title patterns when 
>> there are two or more key attributes"
>>
>> Any help or pointers would be appreciated.
>>
>> #Puppet Manifest: 
>>
>>   rabbitmq_binding { 'testing':
>>
>> source  => "src",
>>
>> destination => "dest",
>>
>>   }
>>
>> # Puppet Type
>>
>> Puppet::Type.newtype(:rabbitmq_binding) do
>>
>>   desc 'rabbitmq_binding creates a puppet type for managing rabbitMQ 
>> binding'
>>
>>   def self.title_patterns
>>
>> [ [
>>
>> /^(.*):(.*)$/,  # pattern to parse :
>>
>> [
>>
>>   [:source, lambda{|x| x} ],
>>
>>   [:destination, lambda{|x| x} ]
>>
>> ] ]
>>
>> ]
>>
>>   end
>>
>>   newparam( :source ) do  
>>
>> isnamevar
>>
>>   end
>>
>>   newparam( :destination ) do
>>
>> isnamevar
>>
>>   end
>>
>> end
>>
>

-- 
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/e2d75037-3b6a-472a-8545-da94ed69a7dd%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] Problem with puppetlabs-firewall and ip range

2014-01-26 Thread Louis Coilliot
Hello,

I use puppetlabs-firewall 0.4.2

I have some rules :

firewall { '138 jboss node to node udp' :
chain   => 'INPUT',
proto   => 'udp',
src_range   => $jboss7::params::ip_range,
dst_range   => $jboss7::params::ip_range,
action  => 'accept',
}

firewall { '139 jboss node to node tcp' :
chain   => 'INPUT',
proto   => 'tcp',
src_range   => $jboss7::params::ip_range,
dst_range   => $jboss7::params::ip_range,
action  => 'accept',
}

Each time I run puppet on the node, I have some configuration changes :

First run :

Notice: /Firewall[138 jboss node to node udp]/src_range: src_range changed
'udp' to '192.168.0.60-192.168.0.62'
Notice: /Firewall[138 jboss node to node udp]/proto: proto changed
'192.168.0.60-192.168.0.62' to 'udp'
Notice: Firewall[138 jboss node to node udp](provider=iptables): Properties
changed - updating rule
Notice: /Firewall[139 jboss node to node tcp]/src_range: src_range changed
'tcp' to '192.168.0.60-192.168.0.62'
Notice: /Firewall[139 jboss node to node tcp]/proto: proto changed
'192.168.0.60-192.168.0.62' to 'tcp'
Notice: Firewall[139 jboss node to node tcp](provider=iptables): Properties
changed - updating rule

Second run :
Notice: /Firewall[138 jboss node to node udp]/src_range: src_range changed
'udp' to '192.168.0.60-192.168.0.62'
Notice: /Firewall[138 jboss node to node udp]/proto: proto changed
'192.168.0.60-192.168.0.62' to 'udp'
Notice: Firewall[138 jboss node to node udp](provider=iptables): Properties
changed - updating rule
Notice: /Firewall[139 jboss node to node tcp]/src_range: src_range changed
'tcp' to '192.168.0.60-192.168.0.62'
Notice: /Firewall[139 jboss node to node tcp]/proto: proto changed
'192.168.0.60-192.168.0.62' to 'tcp'
Notice: Firewall[139 jboss node to node tcp](provider=iptables): Properties
changed - updating rule

And so on.

The rules seem to be applied correctly :

# iptables -L -n -v | egrep 'Chain INPUT|pkts|node to node'
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target prot opt in out source
destination
0 0 ACCEPT udp  --  *  *   0.0.0.0/0
0.0.0.0/0   source IP range 192.168.0.60-192.168.0.62 destination
IP range 192.168.0.60-192.168.0.62 /* 138 jboss node to node udp */
   40  2400 ACCEPT tcp  --  *  *   0.0.0.0/0
0.0.0.0/0   source IP range 192.168.0.60-192.168.0.62 destination
IP range 192.168.0.60-192.168.0.62 /* 139 jboss node to node tcp */


Any idea ?

Thanks in advance.

Louis Coilliot

-- 
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/CAE9jN33LVPSCrK86gAzKiHxJjbcU5Vrk62bNU%3DwYr2ZTEVhVyg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] Puppet Custom Types, the easy way

2014-01-26 Thread bert hajee
We have written a library to make it easier to build Puppet Custom Types. Check 
out our first blog post  introducing 
easy_type. 
I'm really curious if this fits the needs of any Puppet developers out 
there. Please let me know if you like it. Also let me know if you don't 
like it or would like to see some changes.

Regards,

Bert hajee

-- 
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/81a7f341-2e07-4824-9b5e-05061eb419f5%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] Module ordering in nodes.pp

2014-01-26 Thread Sam Rajagopal
I have nodes.pp defined as follows
 
node "abc.x.com", "123.x.com" {
include module1
include module2
include module3
}
 
Very simple definition. No parameterization, no scoping etc
When I run "puppet agent -t" on the agent, I see the execution jumping to 
module 3 after module 1. 
Not sure how I can do "before" or "after" to say - execute module 2 only if 
module 1 is successful.
 
Also, I get different results when I run the agent second time. Say, 
something was owned by app user. Next time it becomes, root user. 
appreciate any help.

-- 
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/b372c1fd-e8b4-4084-91d9-21394435614b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] Module ordering in nodes.pp

2014-01-26 Thread Jose Luis Ledesma
You have to make use of chaining arrows in order to establish a dependency. 

http://docs.puppetlabs.com/puppet/3/reference/lang_relationships.html#chaining-arrows

Regards,

-- 
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/04531bd2-21ef-4bf7-ac9d-8989826bc334%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.