~ubuntu-branches/ubuntu/trusty/puppet/trusty

« back to all changes in this revision

Viewing changes to lib/puppet/application/apply.rb

  • Committer: Package Import Robot
  • Author(s): Stig Sandbeck Mathisen
  • Date: 2011-10-22 14:08:22 UTC
  • mfrom: (1.1.25) (3.1.32 sid)
  • Revision ID: package-import@ubuntu.com-20111022140822-odxde5lohc45yhuz
Tags: 2.7.6-1
* New upstream release (CVE-2011-3872)
* Remove cherry-picked "groupadd_aix_warning" patch
* Install all new manpages

Show diffs side-by-side

added added

removed removed

Lines of Context:
82
82
  Enable full debugging.
83
83
 
84
84
* --detailed-exitcodes:
85
 
  Provide transaction information via exit codes. If this is enabled, an
86
 
  exit code of '2' means there were changes, and an exit code of '4'
87
 
  means that there were failures during the transaction.
 
85
  Provide transaction information via exit codes. If this is enabled, an exit
 
86
  code of '2' means there were changes, an exit code of '4' means there were
 
87
  failures during the transaction, and an exit code of '6' means there were both
 
88
  changes and failures.
88
89
 
89
90
* --help:
90
91
  Print this help message
168
169
    end
169
170
 
170
171
    # Collect our facts.
171
 
    unless facts = Puppet::Node::Facts.indirection.find(Puppet[:certname])
172
 
      raise "Could not find facts for #{Puppet[:certname]}"
 
172
    unless facts = Puppet::Node::Facts.indirection.find(Puppet[:node_name_value])
 
173
      raise "Could not find facts for #{Puppet[:node_name_value]}"
 
174
    end
 
175
 
 
176
    unless Puppet[:node_name_fact].empty?
 
177
      Puppet[:node_name_value] = facts.values[Puppet[:node_name_fact]]
 
178
      facts.name = Puppet[:node_name_value]
173
179
    end
174
180
 
175
181
    # Find our Node
176
 
    unless node = Puppet::Node.indirection.find(Puppet[:certname])
177
 
      raise "Could not find node #{Puppet[:certname]}"
 
182
    unless node = Puppet::Node.indirection.find(Puppet[:node_name_value])
 
183
      raise "Could not find node #{Puppet[:node_name_value]}"
178
184
    end
179
185
 
180
186
    # Merge in the facts.
208
214
      configurer = Puppet::Configurer.new
209
215
      report = configurer.run(:skip_plugin_download => true, :catalog => catalog)
210
216
 
211
 
      exit( options[:detailed_exitcodes] ? report.exit_status : 0 )
 
217
      if not report
 
218
        exit(1)
 
219
      elsif options[:detailed_exitcodes] then
 
220
        exit(report.exit_status)
 
221
      else
 
222
        exit(0)
 
223
      end
212
224
    rescue => detail
213
225
      puts detail.backtrace if Puppet[:trace]
214
226
      $stderr.puts detail.message