添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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

Summary

In my Ansible playbook, I am calling the monolithprojects.github_actions_runner role, and during the collect_info block, it calls this task: https://github.com/MonolithProjects/ansible-github_actions_runner/blob/1.21.1/tasks/collect_info.yml#L61

This task then fails with this error:

TASK [monolithprojects.github_actions_runner : Find the latest runner version (RUN ONCE)] ****************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: http.client.IncompleteRead: IncompleteRead(18680 bytes read)
fatal: [<censored>-> localhost]: FAILED! => changed=false 
  module_stderr: |-
    Traceback (most recent call last):
      File "/opt/homebrew/Cellar/[email protected]/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 579, in _get_chunk_left
        chunk_left = self._read_next_chunk_size()
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/opt/homebrew/Cellar/[email protected]/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 546, in _read_next_chunk_size
        return int(line, 16)
               ^^^^^^^^^^^^^
    ValueError: invalid literal for int() with base 16: b''
    During handling of the above exception, another exception occurred:
    Traceback (most recent call last):
      File "/opt/homebrew/Cellar/[email protected]/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 595, in _read_chunked
        while (chunk_left := self._get_chunk_left()) is not None:
                             ^^^^^^^^^^^^^^^^^^^^^^
      File "/opt/homebrew/Cellar/[email protected]/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 581, in _get_chunk_left
        raise IncompleteRead(b'')
    http.client.IncompleteRead: IncompleteRead(0 bytes read)
    The above exception was the direct cause of the following exception:
    Traceback (most recent call last):
      File "/Users/jnguyen/.ansible/tmp/ansible-tmp-1723652528.318429-26444-68393072659437/AnsiballZ_uri.py", line 107, in <module>
        _ansiballz_main()
      File "/Users/jnguyen/.ansible/tmp/ansible-tmp-1723652528.318429-26444-68393072659437/AnsiballZ_uri.py", line 99, in _ansiballz_main
        invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
      File "/Users/jnguyen/.ansible/tmp/ansible-tmp-1723652528.318429-26444-68393072659437/AnsiballZ_uri.py", line 47, in invoke_module
        runpy.run_module(mod_name='ansible.modules.uri', init_globals=dict(_module_fqn='ansible.modules.uri', _modlib_path=modlib_path),
      File "<frozen runpy>", line 226, in run_module
      File "<frozen runpy>", line 98, in _run_module_code
      File "<frozen runpy>", line 88, in _run_code
      File "/var/folders/4j/y5vppkf55bq8n6r73c1br59m0000gp/T/ansible_ansible.legacy.uri_payload_6turnas8/ansible_ansible.legacy.uri_payload.zip/ansible/modules/uri.py", line 793, in <module>
      File "/var/folders/4j/y5vppkf55bq8n6r73c1br59m0000gp/T/ansible_ansible.legacy.uri_payload_6turnas8/ansible_ansible.legacy.uri_payload.zip/ansible/modules/uri.py", line 724, in main
      File "/opt/homebrew/Cellar/[email protected]/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 473, in read
        return self._read_chunked(amt)
               ^^^^^^^^^^^^^^^^^^^^^^^
      File "/opt/homebrew/Cellar/[email protected]/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 607, in _read_chunked
        raise IncompleteRead(b''.join(value)) from exc
    http.client.IncompleteRead: IncompleteRead(18680 bytes read)
  module_stdout: ''
  msg: |-
    MODULE FAILURE
    See stdout/stderr for the exact error
  rc: 1

It looks like there's an unhandled exception thrown by the standard library's http module, and ansible.builtin.uri doesn't handle it. This error only happens about 50% of the time.

Issue Type

Bug Report

Component Name

ansible.builtin.uri

Ansible Version

$ ansible --version
ansible [core 2.17.1]
  config file = None
  configured module search path = ['/Users/jnguyen/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/homebrew/Cellar/ansible/10.1.0/libexec/lib/python3.12/site-packages/ansible
  ansible collection location = /Users/jnguyen/.ansible/collections:/usr/share/ansible/collections
  executable location = /opt/homebrew/bin/ansible
  python version = 3.12.4 (main, Jun  6 2024, 18:26:44) [Clang 15.0.0 (clang-1500.3.9.4)] (/opt/homebrew/Cellar/ansible/10.1.0/libexec/bin/python)
  jinja version = 3.1.4
  libyaml = True

Configuration

# if using a version older than ansible-core 2.12 you should omit the '-t all'
$ ansible-config dump --only-changed -t all
jnguyen@aerospikes-macbook-pro-4 mac-m1-self-hosted-python-client % ansible-config dump --only-changed -t all
/opt/homebrew/Cellar/ansible/10.1.0/libexec/lib/python3.12/site-packages/paramiko/pkey.py:100: CryptographyDeprecationWarning: TripleDES has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.TripleDES and will be removed from this module in 48.0.0.
  "cipher": algorithms.TripleDES,
/opt/homebrew/Cellar/ansible/10.1.0/libexec/lib/python3.12/site-packages/paramiko/transport.py:259: CryptographyDeprecationWarning: TripleDES has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.TripleDES and will be removed from this module in 48.0.0.
  "class": algorithms.TripleDES,
CONFIG_FILE() = None

OS / Environment

System Version: macOS 14.5
Kernel Version: Darwin 23.5.0
Chip: Apple M1 Pro
Memory: 16 GB

Steps to Reproduce

- name: Setup runner
  hosts: myhosts
  vars:
    runner_user: redacted
    github_account: aerospike
    github_repo: aerospike-client-python
    runner_dir: ~/actions-runner
  roles:
    - role: monolithprojects.github_actions_runner

requirements.yml:

roles:
  - name: monolithprojects.github_actions_runner
    version: 5b2d407
    src: https://github.com/MonolithProjects/ansible-github_actions_runner

Create an inventory.yml with the host name, username, and password for the macOS M1 managed node:

myhosts:
  hosts:
    <censored>:
  vars:
    ansible_user: <censored>
    ansible_password: "<censored>"

Commands:

ansible-galaxy install -r requirements.yml
ANSIBLE_STDOUT_CALLBACK=yaml ansible-playbook -k -i inventory.yml -v ansible.yml

Expected Results

The monolithprojects.github_actions_runner should successfully set up a Github Actions self-hosted runner for the aerospike/aerospike-client-python repository.

Actual Results

`monolithprojects.github_actions_runner` with the error mentioned above.

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
  • lib/ansible/plugins/action/uri.py
  • lib/ansible/modules/uri.py
  • lib/ansible/plugins/test/uri.py
  • If these files are incorrect, please update the component name section of the description or use the component bot command.

    Hello , @juliannguyen4
    For the issue you can try the following to see if these resolve the issue and observe the same
    1. Add Retry or Delay to task (yml)

    - name: Find the latest runner version (RUN ONCE)
      ansible.builtin.uri:
        url: "https://api.github.com/repos/actions/runner/releases/latest"
        return_content: yes
      register: runner_version
      retries: 5
      delay: 10
      until: runner_version is succeeded
    

    2. Add a timeout (even if the response is slow, the client will wait long enough to receive the complete data)

    - name: Find the latest runner version (RUN ONCE)
      ansible.builtin.uri:
        url: "https://api.github.com/repos/actions/runner/releases/latest"
        return_content: yes
        timeout: 60
      register: runner_version