Method: Puppet::Application::Apply#apply

Defined in:
lib/vendor/puppet/application/apply.rb

#applyObject



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/vendor/puppet/application/apply.rb', line 153

def apply
  if options[:catalog] == "-"
    text = $stdin.read
  else
    text = ::File.read(options[:catalog])
  end

  begin
    catalog = Puppet::Resource::Catalog.convert_from(Puppet::Resource::Catalog.default_format,text)
    catalog = Puppet::Resource::Catalog.pson_create(catalog) unless catalog.is_a?(Puppet::Resource::Catalog)
  rescue => detail
    raise Puppet::Error, "Could not deserialize catalog from pson: #{detail}"
  end

  catalog = catalog.to_ral

  require 'puppet/configurer'
  configurer = Puppet::Configurer.new
  configurer.run :catalog => catalog
end