Hi, I''m transitioning a large-ish manifest from plain files with lots of import statements to modules. I used to heavily rely on a pattern like the following class feature { ... class specialized inherits feature { ... class more_special inherits specialized { ... } } } So on a central location I can "include feature", but certain nodes will want to "include feature::specialized" and some even "include feature::specialized::more_special". For the modules transition, I see fit to prepend all classes with their module name, so if the module is named "m_feature", I''ll substitute "include feature" with "include m_feature::feature", which works. What won''t work are the nested classes (e.g. "include m_feature::feature::specialized"). Is there a way I can maintain this naming scheme when using modules and autoloading? (I guess dumping everything in init.pp would work, but I''d prefer not to have to resort to that.) TIA, Felix -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Hi, If you nest classes like that then you probably do have to dump everything in init.pp If however you split the classes and define each in a separate file with the name <class>.pp in the manifests directory of the module, you will be able to "include m_feature::specialized". No problem with the inheritance - I do pretty much the same thing. Bill On Oct 15, 10:05 am, Felix Frank <felix.fr...@alumni.tu-berlin.de> wrote:> Hi, > > I''m transitioning a large-ish manifest from plain files with lots of > import statements to modules. > I used to heavily rely on a pattern like the following > > class feature { > ... > class specialized inherits feature { > ... > class more_special inherits specialized { > ... > } > } > > } > > So on a central location I can "include feature", but certain nodes will > want to "include feature::specialized" and some even "include > feature::specialized::more_special". > > For the modules transition, I see fit to prepend all classes with their > module name, so if the module is named "m_feature", I''ll substitute > "include feature" with "include m_feature::feature", which works. > > What won''t work are the nested classes (e.g. "include > m_feature::feature::specialized"). > > Is there a way I can maintain this naming scheme when using modules and > autoloading? (I guess dumping everything in init.pp would work, but I''d > prefer not to have to resort to that.) > > TIA, > Felix-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On 10/15/2010 10:39 AM, Bill Proud wrote:> Hi, > > If you nest classes like that then you probably do have to dump > everything in init.pp > > If however you split the classes and define each in a separate file > with the name <class>.pp in the manifests directory of the module, you > will be able to "include m_feature::specialized". > > No problem with the inheritance - I do pretty much the same thing. > > > BillHi Bill, thanks for the follow-up. I guess I shall have to either do the init-stunt or change my naming conventions then, as per your suggestion. If I come up with something resembling an alternative solution, I''ll be back :-) Cheers, Felix> On Oct 15, 10:05 am, Felix Frank <felix.fr...@alumni.tu-berlin.de> > wrote: >> Hi, >> >> I''m transitioning a large-ish manifest from plain files with lots of >> import statements to modules. >> I used to heavily rely on a pattern like the following >> >> class feature { >> ... >> class specialized inherits feature { >> ... >> class more_special inherits specialized { >> ... >> } >> } >> >> } >> >> So on a central location I can "include feature", but certain nodes will >> want to "include feature::specialized" and some even "include >> feature::specialized::more_special". >> >> For the modules transition, I see fit to prepend all classes with their >> module name, so if the module is named "m_feature", I''ll substitute >> "include feature" with "include m_feature::feature", which works. >> >> What won''t work are the nested classes (e.g. "include >> m_feature::feature::specialized"). >> >> Is there a way I can maintain this naming scheme when using modules and >> autoloading? (I guess dumping everything in init.pp would work, but I''d >> prefer not to have to resort to that.) >> >> TIA, >> Felix >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.