Ask Your Question

Custom type and confine

asked 2015-02-26 23:23:20 -0600

sheshi gravatar image

I am writing a type with two providers. Can I specify 'confine' option to each provider based on the type param value?



edit retag flag offensive close merge delete


Thanks Greg, That is exactly what I wanted. Let me give it a try. -Sheshi

sheshi gravatar imagesheshi ( 2015-02-27 22:46:36 -0600 )edit

Hi Greg, I am getting undefined local variable or method `resource' for Puppet::Type::, if I am trying to access the resource hash in the confine block. Is 'resource' not visible in the confine block? Thanks -Sheshi

sheshi gravatar imagesheshi ( 2015-02-27 23:47:37 -0600 )edit

Can you post your complete type and provider code and sample usage somewhere for me to look at?

GregLarkin gravatar imageGregLarkin ( 2015-03-02 18:16:00 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2015-02-27 17:56:48 -0600

GregLarkin gravatar image

It does look like you can write something like this:

confine :true => begin
  # Test for the suitability of this provider based on some attributes value
  if (resource[:myparam] == myvalue)

I'm no Puppet provider developer yet, and not too much of a Ruby programmer either, so take this with a large grain of salt and YMMV! I would like to hear if it does what you want, though.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-02-26 23:22:43 -0600

Seen: 318 times

Last updated: Feb 27 '15