Sha256: bb4df94b958829f2f680641504cb7f6afdc0fdeee5e0f93bc8d9d2a732b490db

Contents?: true

Size: 1.72 KB

Versions: 40

Compression:

Stored size: 1.72 KB

Contents

require 'puppet/indirector/face'

Puppet::Indirector::Face.define(:report, '0.0.1') do
  copyright "Puppet Inc.", 2011
  license   "Apache 2 license; see COPYING"

  summary "Create, display, and submit reports."

  save = get_action(:save)
  save.summary "API only: submit a report."
  save.arguments "<report>"
  save.returns "Nothing."
  save.examples <<-'EOT'
    From the implementation of `puppet report submit` (API example):

        begin
          Puppet::Transaction::Report.indirection.terminus_class = :rest
          Puppet::Face[:report, "0.0.1"].save(report)
          Puppet.notice "Uploaded report for #{report.name}"
        rescue => detail
          Puppet.log_exception(detail, "Could not send report: #{detail}")
        end
  EOT

  action(:submit) do
    summary "API only: submit a report with error handling."
    description <<-'EOT'
      API only: Submits a report to the puppet master. This action is
      essentially a shortcut and wrapper for the `save` action with the `rest`
      terminus, and provides additional details in the event of a failure.
    EOT
    arguments "<report>"
    examples <<-'EOT'
      API example:

          # ...
          report  = Puppet::Face[:catalog, '0.0.1'].apply
          Puppet::Face[:report, '0.0.1'].submit(report)
          return report
    EOT
    when_invoked do |report, options|
      begin
        Puppet::Transaction::Report.indirection.terminus_class = :rest
        Puppet::Face[:report, "0.0.1"].save(report)
        Puppet.notice "Uploaded report for #{report.name}"
      rescue => detail
        Puppet.log_exception(detail, "Could not send report: #{detail}")
      end
    end
  end
  deactivate_action(:find)
  deactivate_action(:search)
  deactivate_action(:destroy)
end

Version data entries

40 entries across 40 versions & 2 rubygems

Version Path
puppet-retrospec-1.8.0 vendor/pup410/lib/puppet/face/report.rb
puppet-retrospec-1.7.0 vendor/pup410/lib/puppet/face/report.rb
puppet-4.10.12 lib/puppet/face/report.rb
puppet-4.10.12-x86-mingw32 lib/puppet/face/report.rb
puppet-4.10.12-x64-mingw32 lib/puppet/face/report.rb
puppet-4.10.12-universal-darwin lib/puppet/face/report.rb
puppet-4.10.11 lib/puppet/face/report.rb
puppet-4.10.11-x86-mingw32 lib/puppet/face/report.rb
puppet-4.10.11-x64-mingw32 lib/puppet/face/report.rb
puppet-4.10.11-universal-darwin lib/puppet/face/report.rb
puppet-4.10.10 lib/puppet/face/report.rb
puppet-4.10.10-x86-mingw32 lib/puppet/face/report.rb
puppet-4.10.10-x64-mingw32 lib/puppet/face/report.rb
puppet-4.10.10-universal-darwin lib/puppet/face/report.rb
puppet-retrospec-1.6.1 vendor/pup410/lib/puppet/face/report.rb
puppet-retrospec-1.6.0 vendor/pup410/lib/puppet/face/report.rb
puppet-4.10.9 lib/puppet/face/report.rb
puppet-4.10.9-x86-mingw32 lib/puppet/face/report.rb
puppet-4.10.9-x64-mingw32 lib/puppet/face/report.rb
puppet-4.10.9-universal-darwin lib/puppet/face/report.rb