Class: Puppet::Type::RelationshipMetaparam
- Defined in:
- lib/vendor/puppet/type.rb
Constant Summary
Constants included from Util::Docs
Constants included from Util
Util::AbsolutePathPosix, Util::AbsolutePathWindows
Class Attribute Summary collapse
-
.callback ⇒ Object
Returns the value of attribute callback.
-
.direction ⇒ Object
Returns the value of attribute direction.
-
.events ⇒ Object
Returns the value of attribute events.
-
.subclasses ⇒ Object
Returns the value of attribute subclasses.
Attributes inherited from Parameter
Attributes included from Util::Docs
Class Method Summary collapse
Instance Method Summary collapse
- #munge(references) ⇒ Object
-
#to_edges ⇒ Object
Create edges from each of our relationships.
- #validate_relationship ⇒ Object
Methods inherited from Parameter
aliasvalue, defaultto, desc, #devfail, doc, #fail, format_value_for_display, #initialize, initvars, isnamevar, isnamevar?, isrequired, #log, #metaparam?, munge, #name, newvalues, nodefault, #noop, #pathbuilder, #provider, proxymethods, #remove, required?, #tags, #to_s, unmunge, #unmunge, #unsafe_munge, #unsafe_validate, validate, #validate, #value, #value=
Methods included from Util::Docs
#desc, #dochook, #doctable, #markdown_definitionlist, #markdown_header, #nodoc?, #pad, scrub
Methods included from Util
absolute_path?, activerecord_version, benchmark, binread, chuser, classproxy, #execfail, #execpipe, execute, execute_posix, execute_windows, logmethods, memory, path_to_uri, proxy, replace_file, safe_posix_fork, symbolize, symbolizehash, symbolizehash!, synchronize_on, thinmark, #threadlock, uri_to_path, wait_for_output, which, withumask
Methods included from Util::POSIX
#get_posix_field, #gid, #idfield, #methodbyid, #methodbyname, #search_posix_field, #uid
Methods included from Util::MethodHelper
#requiredopts, #set_options, #symbolize_options
Methods included from Util::Logging
#clear_deprecation_warnings, #deprecation_warning, #send_log
Methods included from Util::LogPaths
Methods included from Util::Errors
#adderrorcontext, #devfail, #error_context, #exceptwrap, #fail
Constructor Details
This class inherits a constructor from Puppet::Parameter
Class Attribute Details
.callback ⇒ Object
Returns the value of attribute callback.
1168 1169 1170 |
# File 'lib/vendor/puppet/type.rb', line 1168 def callback @callback end |
.direction ⇒ Object
Returns the value of attribute direction.
1168 1169 1170 |
# File 'lib/vendor/puppet/type.rb', line 1168 def direction @direction end |
.events ⇒ Object
Returns the value of attribute events.
1168 1169 1170 |
# File 'lib/vendor/puppet/type.rb', line 1168 def events @events end |
.subclasses ⇒ Object
Returns the value of attribute subclasses.
1168 1169 1170 |
# File 'lib/vendor/puppet/type.rb', line 1168 def subclasses @subclasses end |
Class Method Details
.inherited(sub) ⇒ Object
1173 1174 1175 |
# File 'lib/vendor/puppet/type.rb', line 1173 def self.inherited(sub) @subclasses << sub end |
Instance Method Details
#munge(references) ⇒ Object
1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 |
# File 'lib/vendor/puppet/type.rb', line 1177 def munge(references) references = [references] unless references.is_a?(Array) references.collect do |ref| if ref.is_a?(Puppet::Resource) ref else Puppet::Resource.new(ref) end end end |
#to_edges ⇒ Object
Create edges from each of our relationships. :in relationships are specified by the event-receivers, and :out relationships are specified by the event generator. This way ‘source’ and ‘target’ are consistent terms in both edges and events – that is, an event targets edges whose source matches the event’s source. The direction of the relationship determines which resource is applied first and which resource is considered to be the event generator.
1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 |
# File 'lib/vendor/puppet/type.rb', line 1205 def to_edges @value.collect do |reference| reference.catalog = resource.catalog # Either of the two retrieval attempts could have returned # nil. unless = reference.resolve self.fail "Could not retrieve dependency '#{reference}' of #{@resource.ref}" end # Are we requiring them, or vice versa? See the method docs # for futher info on this. if self.class.direction == :in source = target = @resource else source = @resource target = end if method = self.class.callback = { :event => self.class.events, :callback => method } self.debug("subscribes to #{.ref}") else # If there's no callback, there's no point in even adding # a label. = nil self.debug("requires #{.ref}") end rel = Puppet::Relationship.new(source, target, ) end end |
#validate_relationship ⇒ Object
1188 1189 1190 1191 1192 1193 1194 1195 |
# File 'lib/vendor/puppet/type.rb', line 1188 def validate_relationship @value.each do |ref| unless @resource.catalog.resource(ref.to_s) description = self.class.direction == :in ? "dependency" : "dependent" fail "Could not find #{description} #{ref} for #{resource.ref}" end end end |