From 82f49a52c57f8cd84b8e5a61441088d169f2d7ed Mon Sep 17 00:00:00 2001 From: Guillem Anguera Date: Wed, 5 Nov 2014 14:42:38 +0100 Subject: [PATCH] Require rubygems to avoid uninitialized constant Gem --- lib/facter/pip_version.rb | 1 + lib/facter/python_version.rb | 1 + lib/facter/virtualenv_version.rb | 1 + 3 files changed, 3 insertions(+) diff --git a/lib/facter/pip_version.rb b/lib/facter/pip_version.rb index 02b4a0cd..ede29409 100644 --- a/lib/facter/pip_version.rb +++ b/lib/facter/pip_version.rb @@ -1,6 +1,7 @@ # Make pip version available as a fact # 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') pkg = Puppet::Type.type(:package).new(:name => 'python-pip', :allow_virtual => 'false') else diff --git a/lib/facter/python_version.rb b/lib/facter/python_version.rb index 793d4ac1..b74cd40f 100644 --- a/lib/facter/python_version.rb +++ b/lib/facter/python_version.rb @@ -1,6 +1,7 @@ # Make python versions available as facts # In lists default python and system python versions require 'puppet' +require 'rubygems' if Gem::Version.new(Facter.value(:puppetversion)) >= Gem::Version.new('3.6') pkg = Puppet::Type.type(:package).new(:name => 'python', :allow_virtual => 'false') else diff --git a/lib/facter/virtualenv_version.rb b/lib/facter/virtualenv_version.rb index 08873859..4a24c71d 100644 --- a/lib/facter/virtualenv_version.rb +++ b/lib/facter/virtualenv_version.rb @@ -1,6 +1,7 @@ # Make virtualenv version available as a fact # 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') pkg = Puppet::Type.type(:package).new(:name => 'virtualenv', :allow_virtual => 'false') else