--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/234c5510-c2b2-4786-ac76-68a73bf55e7d%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Hi everyone,As I was browsing through a few modules on the Forge I noticed that more and more people seem to have taken to the `if ! defined(Package['name']) {}` to ensure their module doesn't cause a duplicate resource declaration with another module, third party or your own, that is also managing that package.
From a purist perception this should never happen in the first place as there are suddenly two modules declaring the same resource. Unfortunately this is often what it comes down to when you pull in a few modules from the Forge or Github, especially with things like build-essential that a multitude of different things might need. In turn this makes using third-party modules more difficult because they might introduce issues like these that, especially for newcomers to the platform, are troublesome to fix.
I was hoping we could devise a solution, at least for package resources, that would allow multiple declarations of the package and have those declarations resolve themselves. I'm specifically focussing on package here because that's the most common source of trouble, things like an rbenv, rvm and pyenv module all declaring that they need 'build-essential'.
My other thought was that perhaps it should be possible to `require => Package['name']` from any resource and if that resource isn't declared in the catalog spawn the resource ourselves but if it is defined that declaration is used. I'm not sure how we could deal with scenario's where someone requires said package but we explicitly define it as absent in our manifests.
Please spare me the "they're being wrong on the internet" speech, I'm well aware of it but the truth of the matter is you'll never be able to coordinate the community in such a way that this issue doesn't pop up. I'm not really concerned about experienced Puppet users/developers that can solve this for themselves, more about the less developer oriented operator that has to use Puppet for whatever reason. Another approach would be to really curate the modules up on the Forge but I doubt anyone feels like doing that or has the time for it.
I'm not sure if it's even desirable or possible to solve this issue in the first place but I was curious if anyone has given any more thought to this?
Hi,
bumping an old thread with a some news: I've built a proof-of-concept
implementation of John's constraint scheme. Enjoy:
https://github.com/ffrank/puppet/tree/constraints
I'd be grateful for any feedback. Constraints can currently be added as
normal resources to a manifest as shown in the README.
Each is limited to targetting a single resource. I'd be interested in
amending this so that metaparameter-like declarations such as
resource => Package[foo,bar]
resource => [ Package[foo], Service[bar] ]
are supported. There's also some TODOs such as tight validation (i.e.
syntax checks).
An idea for extending the concept is "weak" constrains that won't fail
if a targeted resource is not part of a catalog.
A PR is pending once these additions are complete.
Thanks in advance to anyone who takes a closer look.
Cheers,
Felix
On 02/20/2014 10:17 AM, Daniele Sluijters wrote:
> I like a constrains style solution much better myself to, wasn't aware
> of it at the time.
>
> I think with Puppet 4 we could introduce some additional pain, semver
> wise we'd be
> allowed to do that. If that helped fix this issue once and for all I'm
> pretty sure the
> community would support it too.
--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/534C6A4B.8020408%40Alumni.TU-Berlin.de.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/534CC263.2070403%40Alumni.TU-Berlin.de.
For more options, visit https://groups.google.com/d/optout.
On 04/15/2014 03:01 AM, Andy Parker wrote:Thanks for the input.
> I'm wondering if there is a way of either doing this in a module (do
> the constraint check in a provider), or if there is a change we can
> make to allow this to be in a module. It would be great to be able to
> have the extension points so that these kinds of things don't have to
> go into the puppet repository in order to be tried out.
I even *had* been thinking of hacking the constraint evaluation into the
new type's generate hook. This way, the agent would naturally run them
before the transaction, thinking it was a constraint's way to do
generate additional resources.
This has two limitations, though:
1. The cosmetic issue that the error output alludes to the generation of
additional resources and
2. the critical problem that this hook has no way to interrupt the
transaction.
Usually, exceptions that are raised from types and providers are handled
as "resource local" problems. They will fail the resource, but not the
transaction as a whole.
I currently see no way to do this without patching the transaction code.
Of course, we could just introduce an appropriate hook into the core and
do everything else in modules for a time then.
Seeing as the lonterm goal of the feature would be to serve as the
mortar between third party modules, I'd still see it in tier 1, but
that's just my gut feeling.
It may just become a very common dependency such as concat_file I guess.
But can we deprecate defined() in favor of an external module? :-)
Cheers,
Felix
--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/534CC263.2070403%40Alumni.TU-Berlin.de.
For more options, visit https://groups.google.com/d/optout.
Looking at this (and awesome work Felix) my gut reaction is that this should still be part of the core language.
I don't like the idea of effectively being able to monkey patch the Puppet core flow directly regarding how types and providers interact. I say this mainly because, when I jump between environments, I don't really want to have to figure out what insane collection of "enhancements" were added where and what issues they may be causing.
I'm still going to have to play with this some more and figure out if it meets my use cases before I can comment further.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/CANs%2BFoVdT4DCxMsHGeTv_2130__3LiVPdqVxpBOgaDw1k%2Bka%2Bg%40mail.gmail.com.
Hi,
bumping an old thread with a some news: I've built a proof-of-concept
implementation of John's constraint scheme. Enjoy:
https://github.com/ffrank/puppet/tree/constraints
I'd be grateful for any feedback. Constraints can currently be added as
normal resources to a manifest as shown in the README.
Each is limited to targetting a single resource. I'd be interested in
amending this so that metaparameter-like declarations such as
resource => Package[foo,bar]
resource => [ Package[foo], Service[bar] ]
are supported. There's also some TODOs such as tight validation (i.e.
syntax checks).
An idea for extending the concept is "weak" constrains that won't fail
if a targeted resource is not part of a catalog.
A PR is pending once these additions are complete.
Thanks in advance to anyone who takes a closer look.
--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/d680773d-57bb-49e5-9875-f543ace773b0%40googlegroups.com.
send an email to puppet-dev+unsubscribe@googlegroups.com
<mailto:puppet-dev%2Bunsu...@googlegroups.com>.tvau...@onyxpoint.com <mailto:tvau...@onyxpoint.com>
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-dev/d680773d-57bb-49e5-9875-f543ace773b0%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
Trevor Vaughan
Vice President, Onyx Point, Inc
(410) 541-6699
-- This account not approved for unencrypted proprietary information --
--
You received this message because you are subscribed to the Google
Groups "Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to puppet-dev+unsubscribe@googlegroups.com<mailto:puppet-dev+unsub...@googlegroups.com>.
https://groups.google.com/d/msgid/puppet-dev/CANs%2BFoV3th5f-uHM7wqL6LOPoJf-%2BxWUhB%2BJAAhh7Tua2rA8Pw%40mail.gmail.com
To view this discussion on the web visit
<https://groups.google.com/d/msgid/puppet-dev/CANs%2BFoV3th5f-uHM7wqL6LOPoJf-%2BxWUhB%2BJAAhh7Tua2rA8Pw%40mail.gmail.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/
--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+unsubscribe@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/lnqqkl%245ai%241%40ger.gmane.org.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/53A14820.3080907%40alumni.tu-berlin.de.
For more options, visit https://groups.google.com/d/optout.
Hi Felix,Yes, I'm very aware that the current recommendations are to very cleanly model your system to be able to non-ambiguously define your catalog.However, there have always been arguments that the Puppet language should be declarative throughout which makes for more maintainable and intuitive manifests overall.If you go look for posts surrounding this subject, I'd say that the consensus is because reflection just doesn't work, not because it shouldn't be there.
Frankly, it can solve a LOT of problems for you and make the system designer's life a lot easier.
Scenario 1: A requires B if C but not otherwise.If I don't have reflection in this case, then I have to have documentation that says, hey, if you put A and C together on a system, remember to add B! This is prone to error and is something that the code should just "take care of" for me. I'm aware that you could use a role/profile model to take care of this but you're just making people write extra code for no really good reason except that the language doesn't actually address this issue. (I'll rant about the irritation of figuring out what code is doing in a role/profile system later).
Scenario 2: A requires B if module B is present but do something else otherwise.This one is more about system introspection I suppose but we have all of these lovely Module Forge description files and we can't use them in the language! I would love to be able to do the following:if $::module_mysql <= '1.2' { include 'mysql' } else { service { 'mysql': ensure => running, enable => true } }You can then also use $::module_mysql to set up automatic Hiera hierarchies that run from version down to a default (hieradata/mysql/1.0, hieradata/mysql/0.9, hieradata/mysql/default) and life is magic and wonderful when modules on the forge change.Scenario 1 is obviously what we're referring to in this thread and I think, with the way most cloud component architectures seem to be designed, the burden is being placed on the system user as opposed to the system designer in too many cases. And, frankly, some times you just need to get something working and you hit a point where you realize that you'd have to redesign the system to avoid using reflection and you just don't have time for that or it is going to add a LOT of unnecessary code.
--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/5affcbe8-4a14-4e7f-95da-1e598f10fd5f%40googlegroups.com.
On 2014-18-06 22:44, John Bollinger wrote:
>
> Puppet already has a tool for separating the details of a resource from
> the decision about whether to include it in the catalog: virtual
> resources. Those decisions can be tied to whether a given class is
> declared by having that class realize or (especially) collect the
> resources. In many cases that can be done via a wrapper class or
> definition if the target class itself must not be modified.
>
> Here's an idea: Collectors are already processed very late, so maybe
> they are late enough -- or could be /made/ late enough -- to provide the
> kind of context needed for safe reflection. One might then write
> something along these lines:
>
> Firewall::Rule<| title == 'whatever' and defined == 'firewall' |>
> @firewall::rule { "whatever":
> # ...
> }
>
> Of course, the collector wouldn't need actually to be close to the
> resource declaration, and it might be more general than just one
> resource, but it could be right there with the resource declaration to
> provide something much like an if defined() effect.
>
The only thing this does is to move the problem to a new "phase".
Since the purpose is to add resources, naturally you can add defined
types, which in turn creates many resources. The set of rules then
operate on a moving target (constraint solving).
> For that to be safe though, it would be necessary to prevent the
> collected resources from adding classes to the catalog, probably by
> failing the catalog if any of them try to do so. That restriction might
> be reserved for when the 'defined' key is used in the collector's select
> expression, provided that such collectors were processed after all others.
>
I don't think we absolutely have to protect classes from being included.
In a way they are just resources only singletons.
I am thinking that a module can specify constraints as a predicate
(either on other modules being present, other classes, or resources, or
indeed on some abstract "capability"), and if the predicate becomes true
at the end of the catalog production, then it includes one class from
the module.
This adds a much asked for feature; autoinclude. Inclusion in the
catalog by just adding a module to the modulepath.
(This is the reverse
dependency I was talking about earlier).
In all of these cases, some kind of constraint solver ability is needed
across the new feature, queries and the forming of dependencies (since
you most certainly need to also have control over the order in which the
"injected" classes/resources are later applied.
The other approach I can think of (I wrote about it earlier) is that you
make explicit statements about things that must have been evaluated
before "you" can be evaluated (i.e. "I need these Promises fulfilled /
defined before I can say what I want", and modules are given the ability
to define such promises. This (as John also points out) requires a
context in which a resolution of available Promises can take place
reliably). Maybe a Promise is nothing else but a class, but that you can
tie your evaluation to the outcome to the evaluation of one or many
other classes. (This is an area I hope to be able to work on ideas after
we have released puppet 4).
--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+unsubscribe@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/lnvots%24eod%241%40ger.gmane.org.