Hi, I'm forwarding my question from puppet-users because it didn't get many answers there...


I'm developing some of my custom types, and some of them share same params, with exactly the same methods...

For example, I have these params in three of my types and they are same:

lib/puppet/type/mytype1.rb
lib/puppet/type/mytype2.rb
lib/puppet/type/mytype3.rb

  newproperty(:comment) do
    defaultto ''
  end


Is there a way I can maybe extract that code into some external library and reuse it in all of my three types? Now, this definition is not a problem, but when you start to include various checks, and override methods like insync? and your param code grows to 30-40 lines, and you use it in multiple types, it gets usefull to extract that code to some external class and include it into these types.



I have same problem with methods in providers, for example:

lib/puppet/provider/mytype1/default.rb
lib/puppet/provider/mytype2/default.rb
lib/puppet/provider/mytype3/default.rb

all have for example:

  # sets comment
  def comment=(value)
    @property_hash[:comment]=(value)
  end

Is there a way to extract method provider into some external file and just include it somehow?


If it's possible I would like to escape a route of creating another custom type, and add its value to param of another custom type :-/

--
You received this message because you are subscribed to the Google Groups "Puppet 
Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-dev/534FC8A2.6030601%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to