Squeezer.rpm_repository: FileNotFoundError: [Errno 2] No such file or directory - in load_api

Hello All.

Would you please give some direction.

This runs in a GitHub workflow. ( For a long time now )

Thank you for the help.

Problem:

A hard problem since this week.
This error used to be once in a while.
(Full paste below.)

"/tmp/ansible_pulp.squeezer.rpm_repository_payload_8d5mhr8g/ansible_pulp.squeezer.rpm_repository_payload.zip/ansible_collections/pulp/squeezer/plugins/module_utils/openapi.py", line 79, in load_api
    FileNotFoundError: [Errno 2] No such file or directory: '/home/pulpadm/.cache/squeezer/https___ltitavmwnomadcli01.bmwgroup.net_30082/api.json'

Ansible block

name: Create repositories
  pulp.squeezer.rpm_repository:
     name: "{{ item.name }}"
     description: A brand new repository with a description
     autopublish: false
     state: present
  register: cre_repo
  loop: "{{ repo_data.Repository }}"

Pulp3 running in a three instance pulp-minimal container.
2 x api
2 x content
2 x worker

Nomad as orchestrator.
S3 storage and external DB psql (15.8, server 15.6).

This playbook has been running for +24 months without modification.

While the CI is running and one do - “podman exec -ti squeezer-container”

The below directory and file(s) are present.
/home/pulpadm/.cache/squeezer/https___ltitavmwnomadcli01.abcgroup.net_30082/api.json

OCI from Quay

REPOSITORY                       TAG          IMAGE ID      CREATED        SIZE
nexus.abc.net/pulp/pulp-minimal  3.66         7225b397adf6  13 hours ago   1.63 GB

The squeezer-container used in the GitHub pipeline is SLES15:SP5

Container contains: (build with buildah)

pip3 install --user pulp-cli jmespath ansible
ansible-galaxy collection install ./pulp-squeezer-0.0.14.tar.gz

Expected outcome:

Produce repository - as always.

Pulpcore version:

Pulp plugins installed and their versions:

bash-4.4$ pip3 list
Package             Version
------------------- --------
ansible             4.10.0
ansible-core        2.11.12
appdirs             1.4.3
certifi             2024.2.2
cffi                1.15.1
charset-normalizer  2.0.12
click               8.0.4
contextlib2         21.6.0
cryptography        40.0.2
idna                3.6
importlib-metadata  4.8.3
importlib-resources 5.4.0
Jinja2              3.0.3
jmespath            0.10.0
MarkupSafe          2.0.1
ordered-set         4.0.2
packaging           21.3
pip                 20.0.2
pulp-cli            0.23.2
pulp-glue           0.23.2
pycparser           2.21
pyparsing           2.4.7
PyYAML              6.0.1
requests            2.27.1
resolvelib          0.5.4
schema              0.7.5
setuptools          44.1.1
six                 1.14.0
toml                0.10.2
typing-extensions   4.1.1
urllib3             1.26.18
zipp                3.6.0

bash-4.4$ ansible-galaxy collection list
# /home/pulpadm/.ansible/collections/ansible_collections
Collection    Version
------------- -------
pulp.squeezer 0.0.14

Pulp status

“versions”: {
“deb”: “3.4.0”,
“rpm”: “3.27.2”,
“core”: “3.66.0”,
“file”: “3.66.0”,
“maven”: “0.8.1”,
“ostree”: “2.4.4”,
“python”: “3.12.5”,
“ansible”: “0.22.2”,
“certguard”: “3.66.0”,
“container”: “2.22.0”
}

Operating system - distribution and version:

Other relevant data:

Full error:

TASK [Create repositories] *****************************************************
failed: [localhost] (item={'name': 'upstream-SLES12-SP5-Pool', 'backend': 'http://smt.abc.net/repo/SUSE/Products/SLE-SERVER/12-SP5/x86_64/product/', 'base': 'SUSE/Products/SLE-SERVER/12-SP5/x86_64/product'}) => changed=false 
  ansible_loop_var: item
  item:
    backend: http://smt.abc.net/repo/SUSE/Products/SLE-SERVER/12-SP5/x86_64/product/
    base: SUSE/Products/SLE-SERVER/12-SP5/x86_64/product
    name: upstream-SLES12-SP5-Pool
  module_stderr: |-
    /tmp/ansible_pulp.squeezer.rpm_repository_payload_8d5mhr8g/ansible_pulp.squeezer.rpm_repository_payload.zip/ansible/module_utils/urls.py:176: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography. The next release of cryptography will remove support for Python 3.6.
    Traceback (most recent call last):
      File "/tmp/ansible_pulp.squeezer.rpm_repository_payload_8d5mhr8g/ansible_pulp.squeezer.rpm_repository_payload.zip/ansible_collections/pulp/squeezer/plugins/module_utils/openapi.py", line 79, in load_api
    FileNotFoundError: [Errno 2] No such file or directory: '/home/pulpadm/.cache/squeezer/https___ltnomadcli01.abc.net_30082/api.json'
  
    During handling of the above exception, another exception occurred:
  
    Traceback (most recent call last):
      File "<stdin>", line 100, in <module>
      File "<stdin>", line 92, in _ansiballz_main
      File "<stdin>", line 41, in invoke_module
      File "/usr/lib64/python3.6/runpy.py", line 205, in run_module
        return _run_module_code(code, init_globals, run_name, mod_spec)
      File "/usr/lib64/python3.6/runpy.py", line 96, in _run_module_code
        mod_name, mod_spec, pkg_name, script_name)
      File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
        exec(code, run_globals)
      File "/tmp/ansible_pulp.squeezer.rpm_repository_payload_8d5mhr8g/ansible_pulp.squeezer.rpm_repository_payload.zip/ansible_collections/pulp/squeezer/plugins/modules/rpm_repository.py", line 110, in <module>
      File "/tmp/ansible_pulp.squeezer.rpm_repository_payload_8d5mhr8g/ansible_pulp.squeezer.rpm_repository_payload.zip/ansible_collections/pulp/squeezer/plugins/modules/rpm_repository.py", line 95, in main
      File "/tmp/ansible_pulp.squeezer.rpm_repository_payload_8d5mhr8g/ansible_pulp.squeezer.rpm_repository_payload.zip/ansible_collections/pulp/squeezer/plugins/module_utils/pulp.py", line 78, in __enter__
      File "/tmp/ansible_pulp.squeezer.rpm_repository_payload_8d5mhr8g/ansible_pulp.squeezer.rpm_repository_payload.zip/ansible_collections/pulp/squeezer/plugins/module_utils/openapi.py", line 65, in __init__
      File "/tmp/ansible_pulp.squeezer.rpm_repository_payload_8d5mhr8g/ansible_pulp.squeezer.rpm_repository_payload.zip/ansible_collections/pulp/squeezer/plugins/module_utils/openapi.py", line 84, in load_api
      File "/tmp/ansible_pulp.squeezer.rpm_repository_payload_8d5mhr8g/ansible_pulp.squeezer.rpm_repository_payload.zip/ansible_collections/pulp/squeezer/plugins/module_utils/openapi.py", line 108, in _download_api
      File "/tmp/ansible_pulp.squeezer.rpm_repository_payload_8d5mhr8g/ansible_pulp.squeezer.rpm_repository_payload.zip/ansible/module_utils/urls.py", line 1446, in open
      File "/usr/lib64/python3.6/urllib/request.py", line 223, in urlopen
        return opener.open(url, data, timeout)
      File "/usr/lib64/python3.6/urllib/request.py", line 526, in open
        response = self._open(req, data)
      File "/usr/lib64/python3.6/urllib/request.py", line 544, in _open
        '_open', req)
      File "/usr/lib64/python3.6/urllib/request.py", line 504, in _call_chain
        result = func(*args)
      File "/tmp/ansible_pulp.squeezer.rpm_repository_payload_8d5mhr8g/ansible_pulp.squeezer.rpm_repository_payload.zip/ansible/module_utils/urls.py", line 563, in https_open
      File "/usr/lib64/python3.6/urllib/request.py", line 1352, in do_open
        r = h.getresponse()
      File "/usr/lib64/python3.6/http/client.py", line 1383, in getresponse
        response.begin()
      File "/usr/lib64/python3.6/http/client.py", line 320, in begin
        version, status, reason = self._read_status()
      File "/usr/lib64/python3.6/http/client.py", line 281, in _read_status
        line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
      File "/usr/lib64/python3.6/socket.py", line 586, in readinto
        return self._sock.recv_into(b)
      File "/usr/lib64/python3.6/ssl.py", line 1041, in recv_into
        return self.read(nbytes, buffer)
      File "/usr/lib64/python3.6/ssl.py", line 903, in read
        return self._sslobj.read(len, buffer)
      File "/usr/lib64/python3.6/ssl.py", line 631, in read
        v = self._sslobj.read(len, buffer)
    socket.timeout: The read operation timed out
  module_stdout: ''
  msg: |-
    MODULE FAILURE
    See stdout/stderr for the exact error
  rc: 1
1 Like

From the error message it seems to be using python 3.6. Can you upgrade to a newer version, maybe at least 3.9?

Thanks for the detailed Bugreport!
Looking at the stacktrace in the end, I realize the module is reporting the wrong error message.
The missing api.json is what triggers an http call to fetch that file and all that is just fine. But there you get a read timeout on the ssl socket. So I really don’t know what to do with that.
As Gerrod pointed out, it may well be possible that the old (as in three versions behind the oldest supported version) python’s cryptography library leads to your ssl terminator to just drop the earphone.
I would agree to try to upgrade the code here. But for further investigation, it would be super handy if you could get some hands on corresponding server access logs.

CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography. The next release of cryptography will remove support for Python 3.6.

Hi x9c4

Thank you for the feedback.
I have updated the podman image to use python 3.9 (ansible 2.15) and another to 3.11(ansible2.17).
squeezer 1.17 for both.

The error persists with new challenges with new ansible.
I’ll update.

Correction, squeezer now 0.0.17