Class: Puppet::Rails::ResourceTag
- Defined in:
- lib/vendor/puppet/rails/resource_tag.rb
Class Method Summary collapse
-
.find_all_tags_from_host(db_host) ⇒ Object
returns an array of hash containing tags of a host.
-
.find_all_tags_from_resource(db_resource) ⇒ Object
returns an array of hash containing tags of resource.
Instance Method Summary collapse
Class Method Details
.find_all_tags_from_host(db_host) ⇒ Object
returns an array of hash containing tags of a host
19 20 21 22 23 24 25 |
# File 'lib/vendor/puppet/rails/resource_tag.rb', line 19 def self.(db_host) = db_host.connection.select_all("SELECT t.id, t.resource_id, p.name FROM resource_tags t INNER JOIN resources r ON t.resource_id=r.id INNER JOIN puppet_tags p ON t.puppet_tag_id=p.id WHERE r.host_id=#{db_host.id}") .each do |val| val['resource_id'] = Integer(val['resource_id']) end end |
.find_all_tags_from_resource(db_resource) ⇒ Object
returns an array of hash containing tags of resource
10 11 12 13 14 15 16 |
# File 'lib/vendor/puppet/rails/resource_tag.rb', line 10 def self.(db_resource) = db_resource.connection.select_all("SELECT t.id, t.resource_id, p.name FROM resource_tags t INNER JOIN puppet_tags p ON t.puppet_tag_id=p.id WHERE t.resource_id=#{db_resource.id}") .each do |val| val['resource_id'] = Integer(val['resource_id']) end end |
Instance Method Details
#to_label ⇒ Object
5 6 7 |
# File 'lib/vendor/puppet/rails/resource_tag.rb', line 5 def to_label "#{self.puppet_tag.name}" end |