-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I've been mulling this over and wanted to get opinions on an, ugly, but completely functional approach.
We've been talking about people supplying metadata to describe inter-class
dependencies (inter-module dependencies really, but hear me out). With the
advent of the parameterized class, you could simply write all ifdef
dependencies directly into a parameter like follows:
# Get this for the 'contains' function
include 'stdlib'
class foo (
# No requirements by default
$reqs = ['']
) {
if contains($reqs,'bar') {
include 'bar'
}
...some stuff...
if contains($reqs, 'bar') {
bar::baz { 'something': ... }
}
}
It's not elegant by any means, but it is functional and since (in theory)
puppet only includes a class once, then all of the various includes would be
completely skipped.
If would be nice if, in this example, $reqs was actually a class metaparameter
and Puppet would automatically try to include the class when passed
into that variable.
Benefits:
* Works with the current language structure
* Does what you want it to in terms of not needing defined
Drawbacks:
* Requires the user to have an explicit working knowledge of all modules and
namespaces
* Adds a lot of random logic to the code (unless it becomes a metaparam of
some sort)
Thanks,
Trevor
On 01/27/2012 08:52 AM, Walter Heck wrote:
> Hello,
>
> On Fri, Jan 27, 2012 at 15:20, Felix Frank
> <[email protected]> wrote:
>> how I see need for
>> explicit module dependencies and a system that can automatically
>> download required modules from the forge. I can see this supplementing
>> your idea of constraints nicely, but without it, downloading modules
>> could quickly become a nightmare for users.
> There's something else we need to think about here. Some modules have
> a soft/conditional requirement for other modules. What I mean is that
> if you don't use certain parts of a module, you don't need the module
> that that part of the code refers to. the only decent way I can come
> up with to solve that is to use what for instance in C is done with
> #IFDEF. That way the module could just ignore modules that it doesn't
> _really_ require.
>
> I for instance have modules that allow you to use different backends
> for monitoring or backups. If requirements were done automatically
> based on the whole module, it would need a myriad of other modules,
> only one of which is ever used.
>
> cheers,
- --
Trevor Vaughan
Vice President, Onyx Point, Inc.
email: [email protected]
phone: 410-541-ONYX (6699)
pgp: 0x6C701E94
- -- This account not approved for unencrypted sensitive information --
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
iQEcBAEBAgAGBQJPJBXGAAoJECNCGV1OLcypcXkH/3Y2nqqGgJzAKg9YVj/DjiB7
8zbtA7/nVvC8LwtIwwGi7jY+VcbietGwNC8JOoxnTdFN4dCb1xsAcTqzt8p/NXHE
HhwGIG9YGaMoZzvwtfUGc6wrOeqxLvInq2g6e0Qk5QkhBZVg7T5DV4/mvXfheZOR
n1mENjPNMoRONifb24PqxK91CbRtBmJGxEX8b6pDB529oU6aZxNQi6xSn1KSkCJM
SZjVaDoxPqHC4V9L3/J34Rq8H96tfMvTHvSjI3+/nrX80k9MRTkIw5LMIESfTktM
oHKmIXeYcf1yymepuwFmjEgvQ/hp0P5YWsXX3xhE+OCEoaby0AQ6FRHtSJq2y8E=
=qNAo
-----END PGP SIGNATURE-----
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" 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-users?hl=en.
<<attachment: tvaughan.vcf>>
