-
-
Notifications
You must be signed in to change notification settings - Fork 374
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #555 from wiebe/fix_undefined_method_error_in_facts
Fix undefined method error in facts
- Loading branch information
Showing
3 changed files
with
72 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,26 @@ | ||
# Make pip version available as a fact | ||
|
||
def get_pip_version(executable) | ||
if Facter::Util::Resolution.which(executable) # rubocop:disable Style/GuardClause | ||
results = Facter::Util::Resolution.exec("#{executable} --version 2>&1").match(%r{^pip (\d+\.\d+\.?\d*).*$}) | ||
results[1] if results | ||
end | ||
end | ||
|
||
Facter.add('pip_version') do | ||
setcode do | ||
if Facter::Util::Resolution.which('pip') | ||
Facter::Util::Resolution.exec('pip --version 2>&1').match(%r{^pip (\d+\.\d+\.?\d*).*$})[1] | ||
end | ||
get_pip_version 'pip' | ||
end | ||
end | ||
|
||
Facter.add('pip2_version') do | ||
setcode do | ||
get_pip_version 'pip2' | ||
end | ||
end | ||
|
||
Facter.add('pip3_version') do | ||
setcode do | ||
get_pip_version 'pip3' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters