Hi Nan, thanks a lot. That works and gave me the right direction, in the end one can use: resource_type.validproperties (or self.class.resource_type.validproperties)
Next time I'll check out puppet-dev. Bye Frederik P.S.: BTW nice introductory book ;-) On Wed, Sep 17, 2014 at 6:43 PM, Nan Liu <[email protected]> wrote: > On Wed, Sep 17, 2014 at 6:26 AM, Frederik Wagner <[email protected]> wrote: >> >> Hi everyone, >> >> currently I'm writing a custom provider to configure mailing lists. >> >> In the provider I'm writing I need to access the list of all >> properties (set or unset) defined in the type via 'newproperty'. I'm >> wondering if there's a way to do that. It feels strange if there >> wouldn't. >> >> What I need to do: >> Since upon initial creation of a mailing list not all properties can >> be set, I need to put all defined properties into the @property_hash >> to have them finally set by the flush method. Therefore I need code >> like: >> >> def exists? >> ... create mailing list... >> >> all_properties_from_type.each { |prop| >> @property_hash[prop] = @resource[prop] unless @resource[prop].nil? >> } >> end >> >> Thanks for any help. >> >> Bye > > > I don't know what your type is called (replace mailing_list with your type > name): > > Puppet::Type.type(:mailing_list).properties.each { ... } > > FYI, puppet-dev is probably the better mailing list for these questions > since the puppet core dev monitor that and would know if the internal API > have been updated recently. > > Thanks, > > Nan > > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/puppet-users/CACqVBqA6SK1eyYCpRByzcuOEFeEWHxtDC2_QHbjG_mYHphkaVw%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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CACBNCokFM5jj%2B3ojv9s3PvsxOcwyJQ%3DmXEcO%2B3qDe5dqkWcYfQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
