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

Assemble module doesn't pass content arg to _get_diff_data #82359

Closed
1 task done
albalitz opened this issue Dec 5, 2023 · 1 comment · Fixed by #82360
Closed
1 task done

Assemble module doesn't pass content arg to _get_diff_data #82359

albalitz opened this issue Dec 5, 2023 · 1 comment · Fixed by #82360
Assignees
Labels
affects_2.16 bug This issue/PR relates to a bug. has_pr This issue has an associated PR. module This issue/PR relates to a module.

Comments

@albalitz
Copy link

albalitz commented Dec 5, 2023

Summary

When using the ansible.builtin.assemble module with --diff, the task fails with the following error:

Unexpected failure during module execution: ActionBase._get_diff_data() missing 1 required positional argument: 'content'

ansible-playbook -vvvv says the relevant function call happens in ansible/plugins/action/assemble.py, line 143.
Note: on my local machine that's currently line 144; 143 is on the current devel branch.

The last known working version is 8.6.1

Issue Type

Bug Report

Component Name

ansible.builtin.assemble

Ansible Version

$ ansible --version
ansible [core 2.16.0]
  config file = None
  configured module search path = ['/Users/albalitz/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/homebrew/Cellar/ansible/9.0.1/libexec/lib/python3.12/site-packages/ansible
  ansible collection location = /Users/albalitz/.ansible/collections:/usr/share/ansible/collections
  executable location = /opt/homebrew/bin/ansible
  python version = 3.12.0 (main, Oct  3 2023, 16:20:33) [Clang 14.0.3 (clang-1403.0.22.14.1)] (/opt/homebrew/Cellar/ansible/9.0.1/libexec/bin/python)
  jinja version = 3.1.2
  libyaml = True

Configuration

$ ansible-config dump --only-changed -t all
CONFIG_FILE() = None
EDITOR(env: EDITOR) = /usr/bin/vim
PAGER(env: PAGER) = less

OS / Environment

This happens on my local machine running MacOS Sonoma 14.1.2 (Ansible installed via homebrew) as well as our CI system running in a python:alpine-based Docker environment with the same Ansible version as above (Ansible is installed via pip there and updated semi-automatically using renovatebot).

Steps to Reproduce

This step fails with the error described above:

- name: create concatenated file
  local_action:
    module: assemble
    remote_src: false
    src: files/some_files/
    dest: /tmp/concatenated_file
  no_log: true
  changed_when: false
  check_mode: no
  become: no
  run_once: true

The step works when --diff is removed from the ansible-playbook command.

Expected Results

I expected the assemble step to run successfully and produce a concatenated file with --diff enabled but without printing the diff (due to no_log: true - I set that to false for debugging purposes to see the error message).

Actual Results

<localhost> ESTABLISH LOCAL CONNECTION FOR USER: albalitz
<localhost> EXEC /bin/sh -c 'echo ~albalitz && sleep 0'
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /Users/albalitz/.ansible/tmp `"&& mkdir "` echo /Users/albalitz/.ansible/tmp/ansible-tmp-1701782995.5552058-23181-40564253413079 `" && echo ansible-tmp-1701782995.5552058-23181-40564253413079="` echo /Users/albalitz/.ansible/tmp/ansible-tmp-1701782995.5552058-23181-40564253413079 `" ) && sleep 0'
Using module file /opt/homebrew/Cellar/ansible/9.0.1/libexec/lib/python3.12/site-packages/ansible/modules/stat.py
<localhost> PUT /Users/albalitz/.ansible/tmp/ansible-local-23119muc1g04o/tmp8owc8yoz TO /Users/albalitz/.ansible/tmp/ansible-tmp-1701782995.5552058-23181-40564253413079/AnsiballZ_stat.py
<localhost> EXEC /bin/sh -c 'chmod u+x /Users/albalitz/.ansible/tmp/ansible-tmp-1701782995.5552058-23181-40564253413079/ /Users/albalitz/.ansible/tmp/ansible-tmp-1701782995.5552058-23181-40564253413079/AnsiballZ_stat.py && sleep 0'
<localhost> EXEC /bin/sh -c '/opt/homebrew/Cellar/ansible/9.0.1/libexec/bin/python /Users/albalitz/.ansible/tmp/ansible-tmp-1701782995.5552058-23181-40564253413079/AnsiballZ_stat.py && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /Users/albalitz/.ansible/tmp/ansible-tmp-1701782995.5552058-23181-40564253413079/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/ansible/9.0.1/libexec/lib/python3.12/site-packages/ansible/executor/task_executor.py", line 165, in run
    res = self._execute()
          ^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/ansible/9.0.1/libexec/lib/python3.12/site-packages/ansible/executor/task_executor.py", line 641, in _execute
    result = self._handler.run(task_vars=vars_copy)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/ansible/9.0.1/libexec/lib/python3.12/site-packages/ansible/plugins/action/assemble.py", line 144, in run
    diff = self._get_diff_data(dest, path, task_vars)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: ActionBase._get_diff_data() missing 1 required positional argument: 'content'
fatal: [shorewall-0 -> localhost]: FAILED! => {}

MSG:

Unexpected failure during module execution: ActionBase._get_diff_data() missing 1 required positional argument: 'content'

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibot ansibot added bug This issue/PR relates to a bug. needs_triage Needs a first human triage before being processed. affects_2.16 module This issue/PR relates to a module. labels Dec 5, 2023
@ansibot
Copy link
Contributor

ansibot commented Dec 5, 2023

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the component bot command.

@Akasurde Akasurde self-assigned this Dec 5, 2023
Akasurde added a commit to Akasurde/ansible that referenced this issue Dec 5, 2023
* content is an optional parameter for _get_diff_data API

Fixes: ansible#82359

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
@ansibot ansibot added the has_pr This issue has an associated PR. label Dec 5, 2023
Akasurde added a commit to Akasurde/ansible that referenced this issue Dec 7, 2023
* content is an optional parameter for _get_diff_data API

Fixes: ansible#82359

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
Akasurde added a commit to Akasurde/ansible that referenced this issue Dec 7, 2023
* content is an optional parameter for _get_diff_data API

Fixes: ansible#82359

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
Akasurde added a commit to Akasurde/ansible that referenced this issue Dec 7, 2023
* content is an optional parameter for _get_diff_data API

Fixes: ansible#82359

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
Akasurde added a commit to Akasurde/ansible that referenced this issue Dec 7, 2023
* content is an optional parameter for _get_diff_data API

Fixes: ansible#82359

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
@bcoca bcoca removed the needs_triage Needs a first human triage before being processed. label Dec 12, 2023
bcoca pushed a commit that referenced this issue Dec 12, 2023
* content is an optional parameter for _get_diff_data API

Fixes: #82359

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
@ansible ansible locked and limited conversation to collaborators Dec 26, 2023
Akasurde added a commit to Akasurde/ansible that referenced this issue Apr 23, 2024
* content is an optional parameter for _get_diff_data API

Fixes: ansible#82359

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
mattclay pushed a commit that referenced this issue May 9, 2024
* content is an optional parameter for _get_diff_data API

Fixes: #82359

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.16 bug This issue/PR relates to a bug. has_pr This issue has an associated PR. module This issue/PR relates to a module.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants