手动安装pyOpenSSL和boto3吗?由于缺少依赖项,因此无法进行拖放操作

问题描述 投票:0回答:1

我有一个为Splunk编写的应用程序,它依赖于boto3和pyOpenSSL库。除了拖放以外,我没有找到一种将应用程序依赖项放入应用程序bin文件夹的好方法,该方法不适用于boto3和pyOpenSSL。

至此,每次我们需要使python模块可用于Splunk中的单个应用程序时,我们都会将python模块拖放到$ SPLUNK_HOME / etc / apps / APP_NAME / bin / MODULE中。这一直有效,直到我们需要pyOpenSSL和boto3库,这些库具有很多加密技术和单个脚本依赖项,并且无法正确传递。

我尝试过的:

1| python3 -m venv $SPLUNK_HOME/etc/apps/APP_NAME/
2| python3 -m pip install (pyOpenSSL, boxsdk, pyJWT, boto3) < base dependencies
3| move $SPLUNK_HOME/etc/apps/APP_NAME/lib/python3.7/site-packages/ > $/SPLUNK_HOME/etc/apps/APP_NAME/bin
4| Put all my app scripts in $/SPLUNK_HOME/etc/apps/APP_NAME/bin alongside all the modules I just installed to that folder using venv
5| Start Splunk
6| search | search_command arg=0

[在这一点上,Splunk告诉我enum34,ipaddress,chainmap,密码术(埋在这里的_constant_time模块在不应该存在的地方)不存在。

然后关闭Splunk,重做步骤1-6,但还要在步骤2上安装所有那些缺少的模块。我现在得到的错误是这样的:

External search command 'boxfiles' returned error code 1. First 1000 (of 1456) bytes of script output: "No module named constant_time ERROR "Error 'No module named constant_time'. Traceback (most recent call last): File ""/Applications/Splunk/etc/apps/TA-box-connector/bin/box_connector/init.py"", line 3, in from box_connector import BoxConnector File ""/Applications/Splunk/etc/apps/TA-box-connector/bin/box_connector/box_connector.py"", line 10, in from OpenSSL import crypto File ""/Applications/Splunk/etc/apps/TA-box-connector/bin/OpenSSL/init.py"", line 8, in from OpenSSL import crypto, SSL File ""/Applications/Splunk/etc/apps/TA-box-connector/bin/OpenSSL/crypto.py"", line 12, in from cryptography import x509 File ""/Applications/Splunk/etc/apps/TA-box-connector/bin/cryptography/x509/init.py"", line 8, in from cryptography.x509.base import ( File ""/Applications/Splunk/etc/apps/TA-box-connector/bin/cryptography/x509/base.py"", line 18, in from cryptography.x509.extensions import Exte".

我想解决这个错误,但是我已经解决了这个依赖关系问题已有一段时间了,因此,如果有更好的解决方案将这些软件包放在这里,我很乐意听到。]

我有一个为Splunk编写的应用程序,它依赖于boto3和pyOpenSSL库。除了拖放以外,我没有找到一种将应用程序依赖项添加到应用程序bin文件夹中的好方法,... ...>

python python-3.x dependencies boto3 splunk
1个回答
1
投票

您可以使用以下命令将依赖项安装到适当的目录中。确保$SPLUNK_HOME设置正确,并用新应用的名称替换APP_NAME

pip install pyOpenSSL -t $SPLUNK_HOME/etc/apps/APP_NAME/bin
pip install boxsdk -t $SPLUNK_HOME/etc/apps/APP_NAME/bin
pip install pyJWT -t $SPLUNK_HOME/etc/apps/APP_NAME/bin
pip install boto3 -t $SPLUNK_HOME/etc/apps/APP_NAME/bin
© www.soinside.com 2019 - 2024. All rights reserved.