| Server IP : 77.68.64.21 / Your IP : 216.73.217.59 Web Server : Apache System : Linux hp3-wp-1011352.hostingp3.local 3.10.0-1160.144.1.el7.tuxcare.els9.x86_64 #1 SMP Fri Jul 10 17:06:31 UTC 2026 x86_64 User : csh2516497 ( 2094697) PHP Version : 8.3.30 Disable Function : shell_exec,exec,system,popen,set_time_limit MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/ruby/vendor_ruby/puppet/rails/ |
Upload File : |
class Puppet::Rails::ResourceTag < ActiveRecord::Base
belongs_to :puppet_tag
belongs_to :resource
def to_label
"#{self.puppet_tag.name}"
end
# returns an array of hash containing tags of resource
def self.find_all_tags_from_resource(db_resource)
tags = 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}")
tags.each do |val|
val['resource_id'] = Integer(val['resource_id'])
end
tags
end
# returns an array of hash containing tags of a host
def self.find_all_tags_from_host(db_host)
tags = 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}")
tags.each do |val|
val['resource_id'] = Integer(val['resource_id'])
end
tags
end
end