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,19 +3,29 @@ Facter.add('pythonsitedir') do
|
|||
if File.exists?('/usr/local/bin/python')
|
||||
pythonbin='/usr/local/bin/python'
|
||||
else
|
||||
system('which python > /dev/null 2>&1')
|
||||
if $? == 0
|
||||
pythonbin='python'
|
||||
end
|
||||
end
|
||||
if pythonbin
|
||||
%x{#{pythonbin} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"}.chomp
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Facter.add('pythonversion') do
|
||||
setcode do
|
||||
if File.exists?('/usr/local/bin/python')
|
||||
pythonbin='/usr/local/bin/python'
|
||||
else
|
||||
system('which python > /dev/null 2>&1')
|
||||
if $? == 0
|
||||
pythonbin='python'
|
||||
end
|
||||
end
|
||||
if pythonbin
|
||||
%x{#{pythonbin} -c "import platform; print platform.python_version()"}.chomp
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue