Ansible raises an exception when running tasks with loops calling super()

Bug #2073569 reported by Diego
20
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Ubuntu Pro
Confirmed
Undecided
Unassigned
ansible (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Running a simple playbook with loops with Ansible 2.5.1 (Ubuntu package version is '2.5.1+dfsg-1ubuntu0.1+esm2', and this is important because in previous version this error was not raised) in Ubuntu 18.04 raises this error:

PLAY [Ansible Bug]
TASK [Show Ansible Version]
fatal: [localhost]: FAILED! => {"msg": "the field 'args' has an invalid value ([]), and could not be converted to an dict.The error was: super() takes at least 1 argument (0 given)\n\nThe error appears to have been in '/home/user/ansible-tests/ansible-bug/bug.yaml': line 12, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n tasks:\n - name: Show Ansible Version\n ^ here\n"}
        to retry, use: --limit @/home/user/ansible-tests/ansible-bug/bug.retry

PLAY RECAP
localhost : ok=0 changed=0 unreachable=0 failed=1

The playbook contains:

- name: Ansible Bug
  hosts: localhost
  connection: local
  gather_facts: no
  vars:
    test_items:
      - a
      - b
  tasks:
    - name: Show Ansible Version
      debug:
        msg: "Ansible Version: {{ ansible_version }} - {{ item }}"
      loop: "{{ test_items }}"

This error is not raised with any other Ansible version.

CVE References

Diego (diegolgz)
tags: added: ansible
tags: added: ubuntu-pro
tags: added: python
no longer affects: ansible
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in ansible (Ubuntu):
status: New → Confirmed
Revision history for this message
Ángel (angel-1) wrote :

This python error appears when trying to run under python2 certain python3-only code. But in this case, it appears when attempting to run an ansible playbook.

It seems to have been caused by the change:

```
ansible (2.5.1+dfsg-1ubuntu0.1+esm2) bionic-security; urgency=medium

  * SECURITY UPDATE: Information Disclosure
    - debian/patches/CVE-2022-3697.patch: fixed a password leaking issue in
      ansible
    - CVE-2022-3697
  * SECURITY UPDATE: Template Injection
    - debian/patches/CVE-2023-5764-[1-2].patch: fixed a template injection flaw
      in ansible
    - CVE-2023-5764

 -- Amir Naseredini <email address hidden> Tue, 18 Jun 2024 19:01:50 +0100
```

Looking for calls to super() with no parameters, there are a number of them on /usr/lib/python2.7/dist-packages/ansible/utils/unsafe_proxy.py and /usr/lib/python2.7/dist-packages/ansible/template/init.py, which seem to be the ones causing the above error.

Upstream commit https://github.com/ansible/ansible/commit/7239d2d371bc6e274cbb7314e01431adce6ae25a#diff-65f6e2e7666c65b61d2dd334ca36e459e04854c3dc040e91c870886d01ce7aa7 certainly adds both `def call()` with super().call(obj, *args, **kwargs) on template/_init_.py as well as a series of super() at unsafe_proxy.py

I don't know what python versions are supported by ansible 2.14. This could be either an upstream bug (if it is expected to keep python2 compatibility) or only one on the backport.

Changed in ubuntu-pro:
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.