Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix in custom fact "apache_version" for OracleLinux. #1416

Merged
merged 2 commits into from
Apr 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/facter/apache_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
setcode do
if Facter::Util::Resolution.which('apachectl')
apache_version = Facter::Util::Resolution.exec('apachectl -v 2>&1')
%r{^Server version: Apache\/([\w\.]+) \(([\w ]+)\)}.match(apache_version)[1]
%r{^Server version: Apache\/([\w\.]+) \(([\w ]*)\)}.match(apache_version)[1]
end
end
end
13 changes: 13 additions & 0 deletions spec/unit/apache_version_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,17 @@
end
end
end

describe 'apache_version with empty OS' do
context 'with value' do
before :each do
Facter::Util::Resolution.stubs(:which).with('apachectl').returns(true)
Facter::Util::Resolution.stubs(:exec).with('apachectl -v 2>&1').returns('Server version: Apache/2.4.6 ()
Server built: Nov 21 2015 05:34:59')
end
it do
expect(Facter.fact(:apache_version).value).to eq('2.4.6')
end
end
end
end