在Jenkins中执行作业时出现OPENSSL_1.0.1错误

时间:2015-05-27 03:39:45

标签: shell jenkins pyopenssl

我已经使用scrapy编写了一个python脚本来抓取一个网站,我正试图通过jenkins建立一个工作来每晚调用脚本(这样很容易看到输出)。

我正在运行jenkins的机器是google compute中的bitnami VM。

我设置了命令以在jenkins中运行shell命令,并且它失败并出现以下错误:

Building on master in workspace /opt/bitnami/apps/jenkins/jenkins_home/jobs/Scrape and Import myco/workspace [workspace] $ /bin/sh -xe /opt/bitnami/apache-tomcat/temp/hudson4165433582945317339.sh
+ /usr/local/myco/myscript.py -l /usr/local/myco/results/7.log -o /usr/local/myco/results/7.json -s /usr/local/myco/results/7.stats myspider 
Traceback (most recent call last):   File "/usr/local/myco/myscript.py", line 5, in <module>
    from twisted.internet import reactor   File "/usr/local/lib/python2.7/dist-packages/twisted/internet/reactor.py", line 38, in <module>
    from twisted.internet import default   File "/usr/local/lib/python2.7/dist-packages/twisted/internet/default.py", line 56, in <module>
    install = _getInstallFunction(platform)   File "/usr/local/lib/python2.7/dist-packages/twisted/internet/default.py", line 44, in _getInstallFunction
    from twisted.internet.epollreactor import install   File "/usr/local/lib/python2.7/dist-packages/twisted/internet/epollreactor.py", line 24, in <module>
    from twisted.internet import posixbase   File "/usr/local/lib/python2.7/dist-packages/twisted/internet/posixbase.py", line 23, in <module>
    from twisted.internet import error, udp, tcp   File "/usr/local/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 29, in <module>
    from twisted.internet._newtls import (   File "/usr/local/lib/python2.7/dist-packages/twisted/internet/_newtls.py", line 21, in <module>
    from twisted.protocols.tls import TLSMemoryBIOFactory, TLSMemoryBIOProtocol   File "/usr/local/lib/python2.7/dist-packages/twisted/protocols/tls.py", line 41, in <module>
    from OpenSSL.SSL import Error, ZeroReturnError, WantReadError   File "/usr/local/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import rand, crypto, SSL   File "/usr/local/lib/python2.7/dist-packages/OpenSSL/rand.py", line 11, in <module>
    from OpenSSL._util import (   File "/usr/local/lib/python2.7/dist-packages/OpenSSL/_util.py", line 7, in <module>
    binding = Binding()   File "/usr/local/lib/python2.7/dist-packages/cryptography/hazmat/bindings/openssl/binding.py", line 114, in __init__
    self._ensure_ffi_initialized()   File "/usr/local/lib/python2.7/dist-packages/cryptography/hazmat/bindings/openssl/binding.py", line 126, in _ensure_ffi_initialized
    cls._modules,   File "/usr/local/lib/python2.7/dist-packages/cryptography/hazmat/bindings/utils.py", line 31, in load_library_for_binding
    lib = ffi.verifier.load_library()   File "/usr/local/lib/python2.7/dist-packages/cffi/verifier.py", line 97, in load_library
    return self._load_library()   File "/usr/local/lib/python2.7/dist-packages/cffi/verifier.py", line 207, in _load_library
    return self._vengine.load_library()   File "/usr/local/lib/python2.7/dist-packages/cffi/vengine_cpy.py", line 155, in load_library
    raise ffiplatform.VerificationError(error) cffi.ffiplatform.VerificationError: importing '/usr/local/lib/python2.7/dist-packages/cryptography/_Cryptography_cffi_e7d09016xc302a38b.so': /usr/local/lib/python2.7/dist-packages/cryptography/_Cryptography_cffi_e7d09016xc302a38b.so: symbol EC_GFp_nistp521_method, version OPENSSL_1.0.1 not defined in file libcrypto.so.1.0.0 with link time reference Build step 'Execute shell' marked build as failure Finished: FAILURE

我很困惑,因为当我运行相同的命令时(因为我的用户和用户jenkins在tomcat下运行)我没有收到此错误,脚本运行正常。

我怀疑这可能与在apache中执行的脚本有关,但我在我的智慧结束并且谷歌搜索没有找到任何明显的解决方案。

如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

  

符号EC_GFp_nistp521_method,版本OPENSSL_1.0.1未在文件libcrypto.so.1.0.0中定义

看起来你正在运行一个用OpenSSL 1.0.1编译的python和一个来自OpenSSL 1.0.0的libcrypto。这可能是因为你使用不同的python运行(至少针对不同的OpenSSL版本编译),但是包含来自本地python安装的文件,这些文件需要更新的OpenSSL。