On Tue, 2009-10-20 at 23:51 -0700, Luke Kanies wrote:
> On Oct 20, 2009, at 11:30 PM, Brice Figureau wrote:
>
> >
> >
> > On Wed, October 21, 2009 00:34, Luke Kanies wrote:
> >>
> >> On Oct 20, 2009, at 2:33 PM, Brice Figureau wrote:
> >>
> >>>
> >>> On 20/10/09 20:54, Luke Kanies wrote:
> >>>> I'm a little confused by this patch, or at least by the last test -
> >>>> does it make it so you can't query both tags and params at the same
> >>>> time, or does it just make it so that tag queries don't also query
> >>>> the
> >>>> tag param?
> >>>
> >>> First, and unlike what I wrote in my Puppet Camp presentation you
> >>> can't
> >>> use and/or in an exported collection expression, so you can't
> >>> query by
> >>> tag and parameters at the same time.
> >>
> >> You couldn't a long time ago, but I'm pretty sure you can now:
> >>
> >> if oper == "=" or oper == "!="
> >> # Add the rails association info where necessary
> >> case str1
> >> when "title"
> >> str = "title #{oper} '#{str2}'"
> >> when "tag"
> >> str = "puppet_tags.name #{oper} '#{str2}'"
> >> else
> >> str = "param_values.value #{oper} '#{str2}' and " +
> >> "param_names.name = '#{str1}'"
> >> end
> >> else
> >> str = "(%s) %s (%s)" % [str1, oper, str2]
> >> end
> >>
> >> that second to last line certainly implies that you can do 'AND' and
> >> 'OR'.
> >
> > Maybe, but that's not clear because in the previous block you have:
> >
> > case @oper
> > when "and", "or"
> > if form == :exported
> > raise Puppet::ParseError, "Puppet does not currently
> > support collecting exported resources with more than one
> > condition"
> > end
> > oper = @oper.upcase
> > when "=="; oper = "="
> > else
> > oper = @oper
> > end
> >
> > Which to me means and/or are not supported in exported collections...
> > And looking to the git history this part is there since 2007, so a
> > long
> > time before I started hacking there :-)
>
> Wow, I *totally* thought I fixed that. Insane and inane. I think I
> (or you) fixed all of the plumbing so it *shoud* work, but just never
> removed the exception that prevents it from working.
The problem is that it's much more complex than just feeding AR with the
extra conditions, because each time you have to add an and/or you need
to add two extra joins (and I think it's much more complex with or).
I'm not sure AR is able to do that free for us.
So anyway, I think it can't work directly, just by removing the
exception.
> On the one hand, this sucks, but on the other hand, it makes our
> problem of needing an abstract query language that allows us to make
> all of our Rails support pluggable about 100x easier -- we don't have
> to support boolean expressions, just that basic attribute query.
That's one of the reason I'd like to keep it that way. In my own usage
pattern of collections, I never felt I had to use logical expression.
Looking at it, I'm sure I'm only collecting by tag which is, I guess,
what everybody is doing (what's the point on collecting on titles or
file owner?).
--
Brice Figureau
Follow the latest Puppet Community evolutions on www.planetpuppet.org!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---