Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #1930 Replaced for code based on ssl.get_server_certificate(). #1967

Conversation

ihumster
Copy link
Collaborator

SUMMARY

Replaced for code based on ssl.get_server_certificate().

Fixes #1930

ISSUE TYPE
  • Bugfix Pull Request

@ihumster
Copy link
Collaborator Author

recheck

@mariolenz
Copy link
Collaborator

I don't think that rechecking will help. The CI fails in vmware_content_library_info with:

fatal: [testhost]: FAILED! => {
    "changed": false,
    "module_stderr": "/home/zuul/venv/lib/python3.11/site-packages/urllib3/connectionpool.py:1099: InsecureRequestWarning: Unverified HTTPS request is being made to host 'vcenter.test'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n  warnings.warn(\n/home/zuul/venv/lib/python3.11/site-packages/urllib3/connectionpool.py:1099: InsecureRequestWarning: Unverified HTTPS request is being made to host 'vcenter.test'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n  warnings.warn(\n/home/zuul/venv/lib/python3.11/site-packages/urllib3/connectionpool.py:1099: InsecureRequestWarning: Unverified HTTPS request is being made to host 'vcenter.test'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n  warnings.warn(\n/home/zuul/venv/lib/python3.11/site-packages/urllib3/connectionpool.py:1099: InsecureRequestWarning: Unverified HTTPS request is being made to host 'vcenter.test'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n  warnings.warn(\nTraceback (most recent call last):\n  File \"<stdin>\", line 121, in <module>\n  File \"<stdin>\", line 113, in _ansiballz_main\n  File \"<stdin>\", line 61, in invoke_module\n  File \"<frozen runpy>\", line 226, in run_module\n  File \"<frozen runpy>\", line 98, in _run_module_code\n  File \"<frozen runpy>\", line 88, in _run_code\n  File \"/tmp/ansible_vmware_content_library_manager_payload_okhq4ssw/ansible_vmware_content_library_manager_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_content_library_manager.py\", line 438, in <module>\n  File \"/tmp/ansible_vmware_content_library_manager_payload_okhq4ssw/ansible_vmware_content_library_manager_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_content_library_manager.py\", line 434, in main\n  File \"/tmp/ansible_vmware_content_library_manager_payload_okhq4ssw/ansible_vmware_content_library_manager_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_content_library_manager.py\", line 219, in process_state\n  File \"/tmp/ansible_vmware_content_library_manager_payload_okhq4ssw/ansible_vmware_content_library_manager_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_content_library_manager.py\", line 338, in state_create_library\n  File \"/tmp/ansible_vmware_content_library_manager_payload_okhq4ssw/ansible_vmware_content_library_manager_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_content_library_manager.py\", line 284, in create_update\n  File \"/home/zuul/venv/lib/python3.11/site-packages/com/vmware/content_client.py\", line 807, in create\n    return self._invoke('create',\n           ^^^^^^^^^^^^^^^^^^^^^^\n  File \"/home/zuul/venv/lib/python3.11/site-packages/vmware/vapi/bindings/stub.py\", line 345, in _invoke\n    return self._api_interface.native_invoke(ctx, _method_name, kwargs)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/home/zuul/venv/lib/python3.11/site-packages/vmware/vapi/bindings/stub.py\", line 295, in native_invoke\n    raise TypeConverter.convert_to_python(method_result.error,  # pylint: disable=E0702\ncom.vmware.vapi.std.errors_client.InvalidArgument: {messages : [LocalizableMessage(id='com.vmware.vdcs.cls-main.invalid_storage_backing_inaccessible', default_message='The provided storage backing rw_datastore for library 197f95de-5b05-4770-9a6c-5b8ddfc45b9f is inaccessible.', args=['rw_datastore', '197f95de-5b05-4770-9a6c-5b8ddfc45b9f'], params=None, localized=None)], data : None, error_type : INVALID_ARGUMENT}\n/home/zuul/venv/lib/python3.11/site-packages/urllib3/connectionpool.py:1099: InsecureRequestWarning: Unverified HTTPS request is being made to host 'vcenter.test'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n  warnings.warn(\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}

This doesn't look related to your changes because I think this module doesn't use get_cert_fingerprint(). Might be a change in one of the libs we depend on.

FYI this looks suspiciously like something mentioned in the forum.

I'll have to investigate this a bit...

@ihumster
Copy link
Collaborator Author

I saw that the problem is in vmware_content_library_info. But anyway, first I want to get a second result of the same kind before conducting further investigation. Knowing our CI >_<

@mariolenz
Copy link
Collaborator

I've created #1968 to investigate this further.

Maybe we can fix the issue like this:

if not self.validate_certs:
if HAS_URLLIB3:
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

I'll work on it and let you know if I found a solution.

@mariolenz
Copy link
Collaborator

What is this?! I thought I would understand why the CI failed, but now I don't understand why it started to succeed again... I realyy hate things like this...

@ihumster
Copy link
Collaborator Author

@mariolenz As I said earlier - knowing our CI, until I get a 100% reproducible problem, I will not investigate. 😂

@ihumster
Copy link
Collaborator Author

recheck

Copy link
Collaborator

@mariolenz mariolenz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

But it would be great if @Fredouye would give us some feedback on this.

@mariolenz
Copy link
Collaborator

I can't test this at the moment with Python 3.12. I was hoping @Fredouye would test this but we didn't get any feedback :-/

As an alternative, I thought we could make the CI test your code with Python 3.12. So I've opened ansible/ansible-zuul-jobs#1844 and #1974 but it looks like there is a problem with Python 3.12.

I'll try to make the CI succeed with Python 3.12 and then we could test you changes there.

However, I'd like to do a new release soon and would like to have your changes there. Should we merge in 2 or 3 days, anyway? I mean, it doesn't look like your changes break anything (CI succeeded) even if we're not 100% sure that your PR really fixes the issues.

@mariolenz
Copy link
Collaborator

It looks like the vSphere Automation Python SDK has some problems with Python 3.12 (vmware/vsphere-automation-sdk-python#407 and vmware/vsphere-automation-sdk-python#400). So I don't see how our CI could succeed until they've fixed this.

I'm not 100% sure if this PR fixes #1930 because I can't test at the moment, but it looks like it does to me. So let's merge, especially since the CI is happy so it shouldn't break anything.

Thanks @ihumster!

@mariolenz mariolenz added bug This issue/PR relates to a bug has_issue mergeit labels Jan 23, 2024
Copy link

Build succeeded (gate pipeline).
https://ansible.softwarefactory-project.io/zuul/buildset/a4c2f7940c7440cdbb50f0c7a64548cb

✔️ ansible-tox-linters SUCCESS in 9m 28s
✔️ build-ansible-collection SUCCESS in 8m 06s
✔️ ansible-galaxy-importer SUCCESS in 3m 45s

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit 754e6c1 into ansible-collections:main Jan 23, 2024
11 checks passed
@ihumster ihumster deleted the fix-ssl-deprection-function-#1930 branch January 23, 2024 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug has_issue mergeit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ssl.wrap_socket() was removed in Python 3.12
2 participants