Skip to content

Commit

Permalink
Merge pull request #148 from esendex/master
Browse files Browse the repository at this point in the history
Amended facter pupperversion check to cope with Enterprise string
  • Loading branch information
shivapoudel committed Nov 14, 2014
2 parents 60d97eb + f057bff commit 35810f9
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
10 changes: 9 additions & 1 deletion lib/facter/pip_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@
# Works with pip loaded and without, pip installed using pip and package installed
require 'puppet'
require 'rubygems'
if Gem::Version.new(Facter.value(:puppetversion)) >= Gem::Version.new('3.6')

facter_puppet_version = Facter.value(:puppetversion)
facter_is_pe = Facter.value(:is_pe)

if facter_is_pe
facter_puppet_version = facter_puppet_version.to_s.split(' ')[0]
end

if Gem::Version.new(facter_puppet_version) >= Gem::Version.new('3.6')
pkg = Puppet::Type.type(:package).new(:name => 'python-pip', :allow_virtual => 'false')
else
pkg = Puppet::Type.type(:package).new(:name => 'python-pip')
Expand Down
10 changes: 9 additions & 1 deletion lib/facter/python_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@
# In lists default python and system python versions
require 'puppet'
require 'rubygems'
if Gem::Version.new(Facter.value(:puppetversion)) >= Gem::Version.new('3.6')

facter_puppet_version = Facter.value(:puppetversion)
facter_is_pe = Facter.value(:is_pe)

if facter_is_pe
facter_puppet_version = facter_puppet_version.to_s.split(' ')[0]
end

if Gem::Version.new(facter_puppet_version) >= Gem::Version.new('3.6')
pkg = Puppet::Type.type(:package).new(:name => 'python', :allow_virtual => 'false')
else
pkg = Puppet::Type.type(:package).new(:name => 'python')
Expand Down
10 changes: 9 additions & 1 deletion lib/facter/virtualenv_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@
# Works with virualenv loaded and without, pip installed and package installed
require 'puppet'
require 'rubygems'
if Gem::Version.new(Facter.value(:puppetversion)) >= Gem::Version.new('3.6')

facter_puppet_version = Facter.value(:puppetversion)
facter_is_pe = Facter.value(:is_pe)

if facter_is_pe
facter_puppet_version = facter_puppet_version.to_s.split(' ')[0]
end

if Gem::Version.new(facter_puppet_version) >= Gem::Version.new('3.6')
pkg = Puppet::Type.type(:package).new(:name => 'virtualenv', :allow_virtual => 'false')
else
pkg = Puppet::Type.type(:package).new(:name => 'virtualenv')
Expand Down

0 comments on commit 35810f9

Please sign in to comment.