While I see your point about ENC, no that's not what I meant.  I perhaps should 
have used a different second example.  There are a great many functional 
classes which aren't necessarily data driven.  I have quite a few modules which 
provide functions used by many other modules, but do not deal with data per se. 
 Any many functional classes would take action based on data from an ENC, but 
the ENC's data would not replace the class.  They would be the "backend code" 
for the "Input data".

If anything, if I was able to move all configuration data into an ENC I would 
need a lot more functional classes, not less.

I'm going to split your thread and make some other comments about ENCs in the 
other thread.

On Jun 11, 2012, at 6:59 PM, Eric Sorenson wrote:
> Jo -- I agree with this sentiment but, assuming you intend the second example 
> below to be complete (this file _only_ contains variable = value pairs, not a 
> mix of pairs and actual resources), I'd describe this as 'data' not 
> 'functional classes'.  The direction people are (and should be) taking is to 
> remove that data from puppet manifest files entirely, instead using a data 
> store that either:
> 
>  (a) drives parameters with which a class is invoked, 
>  (b) back-ends an external node classifier and injects these values in the 
> top-scope `parameters` hash, or
>  (c) serves inline lookups like the heira/extlookup parser functions.
> 
> So yes, data ought to be separated from puppet code, in the same way database 
> models are separated from controller code in MVC frameworks, but that's not 
> especially germane to #11419 and Jeff's original question.  
> 
> To which point: IMO since pluginsync will sync down anything in lib/ and make 
> it available in the interpreter, there should not be a special module 
> namespace for puppet stuff. As Daniel says, things should just live where 
> they'd normally live. A great use case for this is making a face available 
> that uses a 3rd party library (I'm particularly reliant on awesome_print) -- 
> you want to be able to pull that code in without editing the files to make 
> them work, which a separate namespace would impose. 
> 
> As a quick test I pulled everything from lib/* in the awesome_print gem into 
> a lib/ directory in one of the modules on my test puppet server. Sure enough 
> it downloaded to a client fine and *almost* loaded correctly; looks like 
> there might be some loading issues specific to files in this gem's ext/ but 
> at a gross level this seems like it ought to work with no fuss.
> 
> https://gist.github.com/2913894
> 
> -=Eric
> 
> On Jun 6, 2012, at 3:14 PM, Jo Rhett wrote:
> 
>> Hi, Jeff. I'm glad to see you raising this issue.  I'd like to add one more 
>> point to your query:  'libraries' versus 'classes'. Right now the code in 
>> $modulepath often serves two very different needs:
>> 
>> classes == where class = group, where the node definition might look like 
>> this:
>> 
>>      # install and configure a web server
>>      class { 'webserver': }
>> 
>> And then you have functional classes, which operate more like libraries and 
>> are re-used often and differently, and spread throughout other modules:
>>      sysctl::conf { 
>>              "net.core.rmem_max": value => 16777216;
>>              "net.core.wmem_max": value => 16777216;
>>      }
>> 
>> I feel somewhat strongly that the puppet ecosphere would be easier to manage 
>> and document if these two very different types of uses were in different 
>> places.
>> 
>> On Jun 6, 2012, at 12:44 PM, Jeff McCune wrote:
>>> We're struggling a bit to come up with a good story around the
>>> following scenario.
>>> 
>>> Imagine you're a relatively new-to-puppet and new-to-ruby person who
>>> is writing a Puppet Module that contains ruby code.  A type and
>>> provider, custom Facter fact, or new puppet subcommand using faces are
>>> all good examples.
>>> 
>>> When you're in this situation and you find yourself in need of a place
>>> to put some code you've written that will be used by multiple things,
>>> what story should we tell about where to put it?  A concrete example
>>> is a class you've written to display progress bars.  More than one
>>> Puppet face action may need this class and you don't want to duplicate
>>> code by copying the class into each action.
>>> 
>>> The proposal in #11419 [1] is to put utility code inside of the
>>> Puppet::Modules namespace.  The reasoning is that when you're in this
>>> situation your first intuition is probably to put it somewhere inside
>>> of Puppet.  We don't have a place today, so if you look you might
>>> decide to put your utility code in Puppet::Util.  Puppet already uses
>>> this namespace quite a bit though, so the potential for conflicts and
>>> monkey patching is high.
>>> 
>>> Daniel points out Puppet::Modules doesn't actually fix the problem,
>>> two puppet modules may still declare Puppet::Modules::ProgressBar and
>>> fight with each other.  The idea he has is to follow the Ruby
>>> convention of putting it somewhere else in the global namespace.  My
>>> concern here is that the story isn't very opinionated and it may not
>>> be clear to a new person that a file path of lib/puppet shouldn't
>>> really be declaring a namespace of ProgressBar at the top level.  By
>>> ruby conventions this constant should live in lib/progress_bar.rb.
>>> 
>>> If you've read this far, could you provide any concrete examples of
>>> utility code you've written, where you put it, and how you came to
>>> decide to put it there?
>>> 
>>> No matter what we decide about #14149 we're going to clearly document
>>> the story at http://docs.puppetlabs.com/  This email is mainly aimed
>>> at trying to figure out what the story should be.
>>> 
>>> Any thoughts or comments would be greatly welcomed.
>>> 
>>> [1] http://projects.puppetlabs.com/issues/14149
>>> 
>>> Thanks,
>>> -Jeff
>>> 
>>> -- 
>>> You received this message because you are subscribed to the Google Groups 
>>> "Puppet Developers" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to 
>>> [email protected].
>>> For more options, visit this group at 
>>> http://groups.google.com/group/puppet-dev?hl=en.
>>> 
>> 
>> -- 
>> Jo Rhett
>> Net Consonance : net philanthropy to improve open source and internet 
>> projects.
>> 
>> 
>> 
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Puppet Developers" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to 
>> [email protected].
>> For more options, visit this group at 
>> http://groups.google.com/group/puppet-dev?hl=en.
>> 
> 
> - Eric Sorenson - N37 17.255 W121 55.738  - http://twitter.com/ahpook  -
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Puppet Developers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/puppet-dev?hl=en.
> 

-- 
Jo Rhett
Net Consonance : net philanthropy to improve open source and internet projects.



-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to