Wei-Chiu Chuang created AMBARI-26471:
----------------------------------------
Summary: Python test failures: X509_V_FLAG_NOTIFY_POLICY
unsupported
Key: AMBARI-26471
URL: https://issues.apache.org/jira/browse/AMBARI-26471
Project: Ambari
Issue Type: Task
Reporter: Wei-Chiu Chuang
{noformat}
[INFO] --- exec:1.2.1:exec (python-test) @ ambari-agent ---
/home/jenkins/jenkins-agent/workspace/bari-PreCommit-GitHub-PR_PR-3990/ambari-agent/src/main/python/ambari_agent/CommandHooksOrchestrator.py:108:
SyntaxWarning: "is" with a literal. Did you mean "=="?
if "role" is hook_definition and role is None:
Traceback (most recent call last):
File
"/home/jenkins/jenkins-agent/workspace/bari-PreCommit-GitHub-PR_PR-3990/ambari-agent/src/test/python/unitTests.py",
line 221, in <module>
main()
File
"/home/jenkins/jenkins-agent/workspace/bari-PreCommit-GitHub-PR_PR-3990/ambari-agent/src/test/python/unitTests.py",
line 160, in main
suite = all_tests_suite(test_mask)
File
"/home/jenkins/jenkins-agent/workspace/bari-PreCommit-GitHub-PR_PR-3990/ambari-agent/src/test/python/unitTests.py",
line 143, in all_tests_suite
suite = unittest.TestLoader().loadTestsFromNames(tests_list)
File "/usr/lib/python3.10/unittest/loader.py", line 220, in loadTestsFromNames
suites = [self.loadTestsFromName(name, module) for name in names]
File "/usr/lib/python3.10/unittest/loader.py", line 220, in <listcomp>
suites = [self.loadTestsFromName(name, module) for name in names]
File "/usr/lib/python3.10/unittest/loader.py", line 154, in loadTestsFromName
module = __import__(module_name)
File
"/home/jenkins/jenkins-agent/workspace/bari-PreCommit-GitHub-PR_PR-3990/ambari-agent/src/test/python/resource_management/TestDirectoryResource.py",
line 20, in <module>
from ambari_agent import main
File
"/home/jenkins/jenkins-agent/workspace/bari-PreCommit-GitHub-PR_PR-3990/ambari-agent/src/main/python/ambari_agent/main.py",
line 50, in <module>
from ambari_agent.InitializerModule import InitializerModule
File
"/home/jenkins/jenkins-agent/workspace/bari-PreCommit-GitHub-PR_PR-3990/ambari-agent/src/main/python/ambari_agent/InitializerModule.py",
line 33, in <module>
from ambari_agent.CommandStatusDict import CommandStatusDict
File
"/home/jenkins/jenkins-agent/workspace/bari-PreCommit-GitHub-PR_PR-3990/ambari-agent/src/main/python/ambari_agent/CommandStatusDict.py",
line 33, in <module>
from ambari_stomp.adapter.websocket import ConnectionIsAlreadyClosed
File
"/home/jenkins/jenkins-agent/workspace/bari-PreCommit-GitHub-PR_PR-3990/ambari-common/src/main/python/ambari_stomp/adapter/websocket.py",
line 30, in <module>
from ambari_ws4py.client.threadedclient import WebSocketClient
File
"/home/jenkins/jenkins-agent/workspace/bari-PreCommit-GitHub-PR_PR-3990/ambari-common/src/main/python/ambari_ws4py/client/__init__.py",
line 11, in <module>
from ambari_ws4py.websocket import WebSocket
File
"/home/jenkins/jenkins-agent/workspace/bari-PreCommit-GitHub-PR_PR-3990/ambari-common/src/main/python/ambari_ws4py/websocket.py",
line 12, in <module>
from OpenSSL.SSL import Error as pyOpenSSLError
File "/usr/lib/python3/dist-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import crypto, SSL
File "/usr/lib/python3/dist-packages/OpenSSL/crypto.py", line 1579, in
<module>
class X509StoreFlags(object):
File "/usr/lib/python3/dist-packages/OpenSSL/crypto.py", line 1598, in
X509StoreFlags
NOTIFY_POLICY = _lib.X509_V_FLAG_NOTIFY_POLICY
AttributeError: module 'lib' has no attribute 'X509_V_FLAG_NOTIFY_POLICY'. Did
you mean: 'X509_V_FLAG_EXPLICIT_POLICY'?
{noformat}
β
1. SyntaxWarning: "is" with a literal
From:
if "role" is hook_definition and role is None:
π Problem:
"is" checks object identity, not equality. This line should use == for a string
value comparison.
π‘ Fix:
Change that line to:
if "role" == hook_definition and role is None:
Python 3.10+ warns about this because itβs a common logic bug that behaves
incorrectly.
β 2. AttributeError: module 'lib' has no attribute 'X509_V_FLAG_NOTIFY_POLICY'
>From this traceback:
File "/usr/lib/python3/dist-packages/OpenSSL/crypto.py", line 1598, in
X509StoreFlags
NOTIFY_POLICY = _lib.X509_V_FLAG_NOTIFY_POLICY
AttributeError: module 'lib' has no attribute 'X509_V_FLAG_NOTIFY_POLICY'. Did
you mean: 'X509_V_FLAG_EXPLICIT_POLICY'?
π Problem:
Your environment is using a version of pyOpenSSL or libssl where the constant
X509_V_FLAG_NOTIFY_POLICY no longer exists.
This seems to be a compatibility mismatch between:
pyOpenSSL
the underlying libssl / cryptography backend
π‘ Fix Options:
Check your pyOpenSSL version:
pip show pyOpenSSL
If you're on an older version, try upgrading:
pip install --upgrade pyOpenSSL cryptography
Check OpenSSL backend version compatibility: You may be using a pyOpenSSL
version that expects libssl to expose X509_V_FLAG_NOTIFY_POLICY, but your
system libssl does not.
If it's safe to do so, you can try pinning to an earlier version of pyOpenSSL
that doesn't access this constant:
pip install 'pyOpenSSL<23.0.0'
If you're using system packages, consider using a Python virtualenv and
installing pyOpenSSL via pip to avoid this mismatch.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]