[SOLVED] Fix Puppet pip install failure
Problem
==> machine1: Error: Execution of '/usr/local/bin/pip install -q pycrypto' returned 1: Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-uN48ao/pycrypto/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-p66n7t-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-uN48ao/pycrypto/
==> machine1: Error: /Stage[main]/Puphpet_python/Package[pycrypto]/ensure: change from absent to present failed: Execution of '/usr/local/bin/pip install -q pycrypto' returned 1: Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-uN48ao/pycrypto/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-p66n7t-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-uN48ao/pycrypto/
==> machine1: Error: Execution of '/usr/local/bin/pip install -q paramiko' returned 1: Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-D_feRt/pycrypto/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-89hDGU-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-D_feRt/pycrypto/
==> machine1: Error: /Stage[main]/Puphpet_python/Package[paramiko]/ensure: change from absent to present failed: Execution of '/usr/local/bin/pip install -q paramiko' returned 1: Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-D_feRt/pycrypto/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-89hDGU-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-D_feRt/pycrypto/
==> machine1: Error: Execution of '/usr/local/bin/pip install -q robotframework-sshlibrary' returned 1: /usr/local/lib/python2.7/dist-packages/pip-8.1.0-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:315: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
==> machine1: SNIMissingWarning
==> machine1: /usr/local/lib/python2.7/dist-packages/pip-8.1.0-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:120: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
==> machine1: InsecurePlatformWarning
==> machine1: Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-UDSczk/pycrypto/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-xzM9Tb-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-UDSczk/pycrypto/
==> machine1: Error: /Stage[main]/Puphpet_python/Package[robotframework-sshlibrary]/ensure: change from absent to present failed: Execution of '/usr/local/bin/pip install -q robotframework-sshlibrary' returned 1: /usr/local/lib/python2.7/dist-packages/pip-8.1.0-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:315: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
==> machine1: SNIMissingWarning
==> machine1: /usr/local/lib/python2.7/dist-packages/pip-8.1.0-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:120: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
==> machine1: InsecurePlatformWarning
==> machine1: Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-UDSczk/pycrypto/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-xzM9Tb-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-UDSczk/pycrypto/
Solution
In Python.pp found in puphpet/puppet/manifests/Python.pp, add require => Package['build-essential'] :
if ! defined(Package[$package_name]) {
notify{"(PYTHON) Installing package ${package_name}" :}
package { $package_name:
ensure => $package_ensure,
provider => pip,
require => Package['build-essential']
}
}
And in config.yaml, make sure you have python-dev, libssl-dev and build-essentials
(...)
server:
install: '1'
packages:
- python-dev
- libssl-dev
- build-essential
- libffi-dev
- libxml2-dev
- libxslt-dev
- expect
- cifs-utils
- libfontconfig1
(...)
This is awesome that you figured this out!
One thing to note, however, you may be better served by creating a bash file and throwing it into the `exec-preprovision` directory. This will run the file one time, before Puppet is called.
Have fun!
Juan