Skip to content

Commit

Permalink
(FACT-2699) Catch augeas exception in resolver.
Browse files Browse the repository at this point in the history
  • Loading branch information
BogdanIrimie committed Jul 31, 2020
1 parent 8d97b65 commit dbd9156
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/facter/resolvers/augeas_resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ def read_augeas_from_gem
# it is used for legacy augeas <= 0.5.0 (ruby-augeas gem)
::Augeas.open { |aug| aug.get('/augeas/version') }
end
rescue LoadError
log.debug('augeas is not available')
nil
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/facter/resolvers/augeas_resolver_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
it 'raises a LoadError error' do
augeas.resolve(:augeas_version)

expect(log_spy).to have_received(:debug).with('resolving fact augeas_version, but load_error_message')
expect(log_spy).to have_received(:debug).with('augeas is not available')
end
end
end
Expand Down

0 comments on commit dbd9156

Please sign in to comment.