Fixed errors from python facts if no python is installed.
This commit is contained in:
parent
24c0218ff1
commit
706c81645a
1 changed files with 14 additions and 4 deletions
|
@ -3,10 +3,15 @@ Facter.add('pythonsitedir') do
|
||||||
if File.exists?('/usr/local/bin/python')
|
if File.exists?('/usr/local/bin/python')
|
||||||
pythonbin='/usr/local/bin/python'
|
pythonbin='/usr/local/bin/python'
|
||||||
else
|
else
|
||||||
|
system('which python > /dev/null 2>&1')
|
||||||
|
if $? == 0
|
||||||
pythonbin='python'
|
pythonbin='python'
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
if pythonbin
|
||||||
%x{#{pythonbin} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"}.chomp
|
%x{#{pythonbin} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"}.chomp
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Facter.add('pythonversion') do
|
Facter.add('pythonversion') do
|
||||||
|
@ -14,8 +19,13 @@ Facter.add('pythonversion') do
|
||||||
if File.exists?('/usr/local/bin/python')
|
if File.exists?('/usr/local/bin/python')
|
||||||
pythonbin='/usr/local/bin/python'
|
pythonbin='/usr/local/bin/python'
|
||||||
else
|
else
|
||||||
|
system('which python > /dev/null 2>&1')
|
||||||
|
if $? == 0
|
||||||
pythonbin='python'
|
pythonbin='python'
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
if pythonbin
|
||||||
%x{#{pythonbin} -c "import platform; print platform.python_version()"}.chomp
|
%x{#{pythonbin} -c "import platform; print platform.python_version()"}.chomp
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue