summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/type.rb38
1 files changed, 4 insertions, 34 deletions
diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb
index 311878841..99ac909cd 100644
--- a/lib/puppet/type.rb
+++ b/lib/puppet/type.rb
@@ -12,6 +12,7 @@ require 'puppet/util/logging'
require 'puppet/resource/reference'
require 'puppet/util/cacher'
require 'puppet/file_collection/lookup'
+require 'puppet/util/tagging'
# see the bottom of the file for the rest of the inclusions
@@ -23,6 +24,7 @@ class Type
include Puppet::Util::Logging
include Puppet::Util::Cacher
include Puppet::FileCollection::Lookup
+ include Puppet::Util::Tagging
###############################
# Code related to resource type attributes.
@@ -1748,42 +1750,10 @@ class Type
return schedule.match?(self.cached(:checked).to_i)
end
- ###############################
- # All of the tagging code.
- attr_reader :tags
-
- # Add a new tag.
- def tag(tag)
- tag = tag.intern if tag.is_a? String
- unless @tags.include? tag
- @tags << tag
- end
- end
-
# Define the initial list of tags.
def tags=(list)
- list = [list] unless list.is_a? Array
-
- @tags = list.collect do |t|
- case t
- when String; t.intern
- when Symbol; t
- else
- self.warning "Ignoring tag %s of type %s" % [tag.inspect, tag.class]
- end
- end
-
- @tags << self.class.name unless @tags.include?(self.class.name)
- end
-
- # Figure out of any of the specified tags apply to this object. This is an
- # OR operation.
- def tagged?(tags)
- tags = [tags] unless tags.is_a? Array
-
- tags = tags.collect { |t| t.intern }
-
- return tags.find { |tag| @tags.include? tag }
+ tag(self.class.name)
+ tag(*list)
end
# Types (which map to resources in the languages) are entirely composed of