Skip to content

Commit

Permalink
(#17522) Only print load errors to debug with non-specific context
Browse files Browse the repository at this point in the history
Fixes a variable assignment that landed in the wrong branch during a conflict
merge (a4451fb).  Commit a8575f4 fixed a spec failure but the original code
wasn't restored.

This restores the original functionality in #14136 where a non-specific
context (i.e. /files/etc) would be optimised (only load lenses for files under
/etc) but since it was vague, would only log load errors to debug.  Instead,
load errors were reported as warnings for non-specific contexts.

Load errors will continue to be reported as warnings for supplied contexts if
they're specific.
  • Loading branch information
Dominic Cleal committed Feb 6, 2013
1 parent 480720f commit cc267a8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 0 additions & 1 deletion lib/puppet/provider/augeas/augeas.rb
Expand Up @@ -171,7 +171,6 @@ def open_augeas
aug.set("/augeas/load/Xfm/incl", resource[:incl])
restricted = true
elsif glob_avail and opt_ctx
restricted = true
# Optimize loading if the context is given, requires the glob function
# from Augeas 0.8.2 or up
ctx_path = resource[:context].sub(/^\/files(.*?)\/?$/, '\1/')
Expand Down
3 changes: 3 additions & 0 deletions spec/unit/provider/augeas/augeas_spec.rb
Expand Up @@ -744,6 +744,7 @@
@resource[:context] = "/files/etc/test"
@resource[:load_path] = my_fixture_dir

@provider.expects(:print_load_errors).with(:warning => true)
aug = @provider.open_augeas
aug.should_not == nil
aug.match("/files/etc/fstab").should == []
Expand All @@ -754,6 +755,7 @@
it "should load standard files if context isn't specific" do
@resource[:context] = "/files/etc"

@provider.expects(:print_load_errors).with(:warning => false)
aug = @provider.open_augeas
aug.should_not == nil
aug.match("/files/etc/fstab").should == ["/files/etc/fstab"]
Expand All @@ -763,6 +765,7 @@
it "should not optimise if the context is a complex path" do
@resource[:context] = "/files/*[label()='etc']"

@provider.expects(:print_load_errors).with(:warning => false)
aug = @provider.open_augeas
aug.should_not == nil
aug.match("/files/etc/fstab").should == ["/files/etc/fstab"]
Expand Down

0 comments on commit cc267a8

Please sign in to comment.