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.
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.
--
Measure with a micrometer. Mark with chalk. Cut with an axe.
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---