On Mon, Jul 25, 2011 at 12:57 PM, Matt Robinson <[email protected]> wrote:

> It's always bothered me that when running puppet inspect (or any
> application that produces a report really) the master gives no
> indication that anything happened when it processes the report.
>

hell yes. Great to see this sorted out.


>
> Reviewed-by: Max Martin <[email protected]>
> Signed-off-by: Matt Robinson <[email protected]>
> ---
>  lib/puppet/indirector/report/processor.rb     |    2 ++
>  spec/unit/indirector/report/processor_spec.rb |   12 +++++++-----
>  2 files changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/lib/puppet/indirector/report/processor.rb
> b/lib/puppet/indirector/report/processor.rb
> index 88fe4b4..81b379e 100644
> --- a/lib/puppet/indirector/report/processor.rb
> +++ b/lib/puppet/indirector/report/processor.rb
> @@ -20,9 +20,11 @@ class Puppet::Transaction::Report::Processor <
> Puppet::Indirector::Code
>   # LAK:NOTE This isn't necessarily the best design, but it's backward
>   # compatible and that's good enough for now.
>   def process(report)
> +    Puppet.debug "Recieved report to process from #{report.host}"
>     return if Puppet[:reports] == "none"
>
>     reports.each do |name|
> +      Puppet.debug "Processing report from #{report.host} with processor
> #{name}"
>       if mod = Puppet::Reports.report(name)
>         # We have to use a dup because we're including a module in the
>         # report.
> diff --git a/spec/unit/indirector/report/processor_spec.rb
> b/spec/unit/indirector/report/processor_spec.rb
> index 5602a27..ac31628 100755
> --- a/spec/unit/indirector/report/processor_spec.rb
> +++ b/spec/unit/indirector/report/processor_spec.rb
> @@ -25,9 +25,11 @@ describe Puppet::Transaction::Report::Processor, " when
> saving a report" do
>
>   it "should not process the report if reports are set to 'none'" do
>     Puppet::Reports.expects(:report).never
> -    Puppet.settings.expects(:value).with(:reports).returns("none")
> +    Puppet[:reports] = 'none'
>
> -    request = stub 'request', :instance => mock("report")
> +    request = Puppet::Indirector::Request.new(:indirection_name, :head,
> "key")
> +    report = Puppet::Transaction::Report.new('apply')
> +    request.instance = report
>
>     @reporter.save(request)
>   end
> @@ -40,14 +42,14 @@ end
>
>  describe Puppet::Transaction::Report::Processor, " when processing a
> report" do
>   before do
> -    Puppet.settings.stubs(:value).with(:reports).returns("one")
> +    Puppet[:reports] = "one"
>     Puppet.settings.stubs(:use)
>     @reporter = Puppet::Transaction::Report::Processor.new
>
>     @report_type = mock 'one'
>     @dup_report = mock 'dupe report'
>     @dup_report.stubs(:process)
> -    @report = mock 'report'
> +    @report = Puppet::Transaction::Report.new('apply')
>     @report.expects(:dup).returns(@dup_report)
>
>     @request = stub 'request', :instance => @report
> @@ -74,7 +76,7 @@ describe Puppet::Transaction::Report::Processor, " when
> processing a report" do
>   end
>
>   it "should not raise exceptions" do
> -    Puppet.settings.stubs(:value).with(:trace).returns(false)
> +    Puppet[:trace] = false
>     @dup_report.expects(:process).raises(ArgumentError)
>     proc { @reporter.save(@request) }.should_not raise_error
>   end
> --
> 1.7.3.1
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Developers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/puppet-dev?hl=en.
>
>


-- 
Nigel Kersten
Product Manager, Puppet Labs

*Join us for **PuppetConf *
<http://www.bit.ly/puppetconfsig>
Sept 22/23 Portland, Oregon, USA.
*
*

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to