Please review pull request #639: (#13659) Convert fact values to string when searching database opened by (pcarlisle)
Description:
When querying inventory_facts we need to treat the fact value as a string,
since it's stored as text in the database. This causes an error to be raised
on postgres.
- Opened: Fri Apr 06 21:39:21 UTC 2012
- Based on: puppetlabs:2.7.x (537488f1a7e4d129a972951e3f9080dfed03a451)
- Requested merge: pcarlisle:ticket/2.7.x/13659-postgres-integer-facts (7e780946f76e499f18cae1d41beae0f5d25a8af7)
Diff follows:
diff --git a/lib/puppet/rails/inventory_node.rb b/lib/puppet/rails/inventory_node.rb index 8d6266e..052745a 100644 --- a/lib/puppet/rails/inventory_node.rb +++ b/lib/puppet/rails/inventory_node.rb @@ -10,14 +10,14 @@ class Puppet::Rails::InventoryNode < ::ActiveRecord::Base scope :has_fact_with_value, lambda { |name,value| { - :conditions => ["inventory_facts.name = ? AND inventory_facts.value = ?", name, value], + :conditions => ["inventory_facts.name = ? AND inventory_facts.value = ?", name, value.to_s], :joins => :facts } } scope :has_fact_without_value, lambda { |name,value| { - :conditions => ["inventory_facts.name = ? AND inventory_facts.value != ?", name, value], + :conditions => ["inventory_facts.name = ? AND inventory_facts.value != ?", name, value.to_s], :joins => :facts } }
--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to puppet-dev@googlegroups.com.
To unsubscribe from this group, send email to puppet-dev+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.