Skip to content

Commit

Permalink
Merge pull request voxpupuli#762 from alexharv074/Issue_758
Browse files Browse the repository at this point in the history
nginx version fact compatibility with Facter 1.7
  • Loading branch information
3flex committed Feb 6, 2016
2 parents 56f407e + 0637222 commit 2ec06f3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/facter/nginx_version.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Facter.add(:nginx_version) do
setcode do
if Facter::Core::Execution.which('nginx')
nginx_version = Facter::Core::Execution.execute('nginx -v 2>&1')
if Facter::Util::Resolution.which('nginx')
nginx_version = Facter::Util::Resolution.exec('nginx -v 2>&1')
%r{^nginx version: nginx\/([\w\.]+)}.match(nginx_version)[1]
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/nginx_version_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
describe "nginx_version" do
context 'with value' do
before :each do
Facter::Core::Execution.stubs(:which).with('nginx').returns(true)
Facter::Core::Execution.stubs(:execute).with('nginx -v 2>&1').returns('nginx version: nginx/1.8.1')
Facter::Util::Resolution.stubs(:which).with('nginx').returns(true)
Facter::Util::Resolution.stubs(:exec).with('nginx -v 2>&1').returns('nginx version: nginx/1.8.1')
end
it {
expect(Facter.fact(:nginx_version).value).to eq('1.8.1')
Expand Down

0 comments on commit 2ec06f3

Please sign in to comment.