On 2014-01-04 11:11, Erik Dalén wrote:
On 1 April 2014 03:43, Ken Barber <[email protected]
<mailto:[email protected]>> wrote:

     >> Upon reflection, I think it would be wise to control which
    resources are
     >> collected strictly via search expressions.  I disfavor a
    configuration
     >> setting affecting that, because if there were one then it would
    be likely
     >> that different modules would be developed with different
    assumptions about
     >> the configured behavior.  Or to put it a different way, people
    should not
     >> need to refer to Puppet's configuration to determine what any
    given snippet
     >> of DSL code means.
     >
     > I guess the problem such a solution leaves is, that people who really
     > do want global collection have to litter their code with explicit
     > environment == '*' clauses. How many people will get affected by this
     > would be interesting, seems at least 2 people on the response so far.
     > Any ideas for that?

    That said, I shouldn't speak for others. For those who do currently
    use global resource collection, how would such a solution affect you?
    And any other thoughts you can think of ...


This seems a bit backwards to me, for all other parts of the query you
just leave it out if you don't want to match on it. There's no need for
a explicit tags=='*' if you want to match on all tags for example. So I
don't see why environment matching would work the opposite way.

So I'm proposing instead that you add environment==$::environment to
your query if you want to collect only from your current environment.


Going forward, I imagine making the query operations in Puppet more flexible and that the query operates on a container of some sort; either all environments, or current environment. Further, the type of the result narrows to an even smaller container. This can be expressed using the type system. I can imagine an Environment[E] type where E is the name of the environment, and Environment[default] is the current environment. Then, the Environment type can be further parameterized with a type. e.g. search for Foo instances in environment test is expressed as:

  Environment[test, Foo] <spaceship>

Just throwing 2c into the pond...

- henrik

--
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-dev/lhejl7%24bs%241%40ger.gmane.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to