Method: Puppet::Resource::TypeCollection#add_hostclass

Defined in:
lib/puppet/resource/type_collection.rb

#add_hostclass(instance) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



64
65
66
67
68
69
70
71
72
# File 'lib/puppet/resource/type_collection.rb', line 64

def add_hostclass(instance)
  handle_hostclass_merge(instance)
  dupe_check(instance, @hostclasses) { |dupe| _("Class '%{klass}' is already defined%{error}; cannot redefine") % { klass: instance.name, error: dupe.error_context } }
  dupe_check(instance, @nodes)       { |dupe| _("Node '%{klass}' is already defined%{error}; cannot be redefined as a class") % { klass: instance.name, error: dupe.error_context } }
  dupe_check(instance, @definitions) { |dupe| _("Definition '%{klass}' is already defined%{error}; cannot be redefined as a class") % { klass: instance.name, error: dupe.error_context } }

  @hostclasses[instance.name] = instance
  instance
end