On Friday, July 12, 2013 3:20:05 PM UTC-5, llowder wrote:
>
>
>
> On Friday, July 12, 2013 11:21:09 AM UTC-7, [email protected] wrote:
>>
>> Say I have the following classes:
>>
>> foo
>> foo::bar::one
>> foo::bar::two
>>
>> Is there a way to declare all classes in the foo::bar namespace at once?
>>
>
>
> Not really, but you can have foo::bar look like:
>
> class foo::bar {
>   include foo::bar::one
>   include foo::bar::two
>   ...
>   include foo::bar::eleventy
> }
>  
> And then you only need to change a single place, and everywhere that needs 
> it can just do "include foo::bar".
>
> There are no automagic ways to do that, and having an automagic way to do 
> it seems really dangerous and like a really bad idea to me.
>
>
I agree.  Moreover, if you're creating so many classes that the requested 
behavior would be a significant win, then the classes at issue are probably 
very repetitive, a set of variations on a common theme.  Such a collection 
of classes probably wants to be a bunch of instances of a single defined 
type instead.

However, if the OP really has to have this, then it should be pretty easy 
to write a code-generator that will automatically update his top-level 
class to declare all the other classes in the module.  That's not quite 
what was requested, but it's about as close as you can get.


John

-- 
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to