From a6c578201195f2d0ef72f40092660b276c2564b4 Mon Sep 17 00:00:00 2001 From: Alex Harvey Date: Fri, 5 Feb 2016 18:11:15 +1100 Subject: [PATCH] nginx version fact compatibility with Facter 1.7 --- lib/facter/nginx_version.rb | 4 ++-- spec/unit/nginx_version_spec.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/facter/nginx_version.rb b/lib/facter/nginx_version.rb index a67e984..f4c1372 100644 --- a/lib/facter/nginx_version.rb +++ b/lib/facter/nginx_version.rb @@ -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 diff --git a/spec/unit/nginx_version_spec.rb b/spec/unit/nginx_version_spec.rb index e2429ae..7ae5af4 100644 --- a/spec/unit/nginx_version_spec.rb +++ b/spec/unit/nginx_version_spec.rb @@ -8,8 +8,8 @@ describe Facter::Util::Fact do 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')