Class: Puppet::Resource::Catalog

Inherits:
SimpleGraph
  • Object
show all
Defined in:
lib/puppet/resource/catalog.rb

Overview

This class models a node catalog. It is the thing meant to be passed from server to client, and it contains all of the information in the catalog, including the resources and the relationships between them.

Constant Summary

Instance Method Summary (collapse)

Instance Method Details

- (Puppet::Transaction) apply(options = {}) {|transaction| ... }

Apply our catalog to the local host.

Parameters:

  • options (Hash{Symbol => Object}) (defaults to: {})

    a hash of options

Options Hash (options):

  • :report (Puppet::Transaction::Report)

    The report object to log this transaction to. This is optional, and the resulting transaction will create a report if not supplied.

  • :tags (Array[String])

    Tags used to filter the transaction. If supplied then only resources tagged with any of these tags will be evaluated.

  • :ignoreschedules (Boolean)

    Ignore schedules when evaluating resources

  • :for_network_device (Boolean)

    Whether this catalog is for a network device

Yields:

  • (transaction)

Returns:

  • (Puppet::Transaction)

    the transaction created for this application



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/puppet/resource/catalog.rb', line 151

def apply(options = {})
  Puppet::Util::Storage.load if host_config?

  transaction = create_transaction(options)

  begin
    transaction.report.as_logging_destination do
      transaction.evaluate
    end
  rescue Puppet::Error => detail
    Puppet.log_exception(detail, "Could not apply complete catalog: #{detail}")
  rescue => detail
    Puppet.log_exception(detail, "Got an uncaught exception of type #{detail.class}: #{detail}")
  ensure
    # Don't try to store state unless we're a host config
    # too recursive.
    Puppet::Util::Storage.store if host_config?
  end

  yield transaction if block_given?

  transaction
end