Skip to content

(CONT-173) - Updating deprecated facter instances #2334

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

Merged
merged 1 commit into from
Oct 13, 2022
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
16 changes: 8 additions & 8 deletions lib/facter/apache_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
setcode do
apache_version = nil

if Facter::Util::Resolution.which('httpd')
apache_version = Facter::Util::Resolution.exec('httpd -V 2>&1')
if Facter::Core::Execution.which('httpd')
apache_version = Facter::Core::Execution.execute('httpd -V 2>&1')
Facter.debug "Matching httpd '#{apache_version}'"
elsif Facter::Util::Resolution.which('apache2')
apache_version = Facter::Util::Resolution.exec('apache2 -V 2>&1')
elsif Facter::Core::Execution.which('apache2')
apache_version = Facter::Core::Execution.execute('apache2 -V 2>&1')
Facter.debug "Matching apache2 '#{apache_version}'"
elsif Facter::Util::Resolution.which('apachectl')
apache_version = Facter::Util::Resolution.exec('apachectl -v 2>&1')
elsif Facter::Core::Execution.which('apachectl')
apache_version = Facter::Core::Execution.execute('apachectl -v 2>&1')
Facter.debug "Matching apachectl '#{apache_version}'"
elsif Facter::Util::Resolution.which('apache2ctl')
apache_version = Facter::Util::Resolution.exec('apache2ctl -v 2>&1')
elsif Facter::Core::Execution.which('apache2ctl')
apache_version = Facter::Core::Execution.execute('apache2ctl -v 2>&1')
Facter.debug "Matching apache2ctl '#{apache_version}'"
end

Expand Down
8 changes: 4 additions & 4 deletions spec/unit/facter/util/fact_apache_version_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
context 'with value' do
before :each do
allow(Facter.fact(:kernel)).to receive(:value).and_return('Linux')
expect(Facter::Util::Resolution).to receive(:which).with('httpd') { true }
expect(Facter::Util::Resolution).to receive(:exec).with('httpd -V 2>&1') {
expect(Facter::Core::Execution).to receive(:which).with('httpd') { true }
expect(Facter::Core::Execution).to receive(:execute).with('httpd -V 2>&1') {
'Server version: Apache/2.4.16 (Unix)
Server built: Jul 31 2015 15:53:26'
}
Expand All @@ -26,8 +26,8 @@
context 'with value' do
before :each do
allow(Facter.fact(:kernel)).to receive(:value).and_return('Linux')
expect(Facter::Util::Resolution).to receive(:which).with('httpd') { true }
expect(Facter::Util::Resolution).to receive(:exec).with('httpd -V 2>&1') {
expect(Facter::Core::Execution).to receive(:which).with('httpd') { true }
expect(Facter::Core::Execution).to receive(:execute).with('httpd -V 2>&1') {
'Server version: Apache/2.4.6 ()
Server built: Nov 21 2015 05:34:59'
}
Expand Down