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

[stable-2.16] assemble: fixed missing parameter error #83124

Merged
merged 1 commit into from May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelogs/fragments/82359_assemble_diff.yml
@@ -0,0 +1,3 @@
---
bugfixes:
- assemble - fixed missing parameter 'content' in _get_diff_data API (https://github.com/ansible/ansible/issues/82359).
2 changes: 1 addition & 1 deletion lib/ansible/plugins/action/__init__.py
Expand Up @@ -1339,7 +1339,7 @@ def _low_level_execute_command(self, cmd, sudoable=True, in_data=None, executabl
display.debug(u"_low_level_execute_command() done: rc=%d, stdout=%s, stderr=%s" % (rc, out, err))
return dict(rc=rc, stdout=out, stdout_lines=out.splitlines(), stderr=err, stderr_lines=err.splitlines())

def _get_diff_data(self, destination, source, task_vars, content, source_file=True):
def _get_diff_data(self, destination, source, task_vars, content=None, source_file=True):

# Note: Since we do not diff the source and destination before we transform from bytes into
# text the diff between source and destination may not be accurate. To fix this, we'd need
Expand Down
16 changes: 16 additions & 0 deletions test/integration/targets/assemble/tasks/main.yml
Expand Up @@ -152,3 +152,19 @@
that:
- "result.state == 'file'"
- "result.checksum == '505359f48c65b3904127cf62b912991d4da7ed6d'"

- name: test assemble with diff
assemble:
src: "./"
dest: "{{remote_tmp_dir}}/assembled11"
remote_src: false
diff: true
register: result

- name: assert the fragments were assembled with diff
assert:
that:
- result.changed
- result.diff.after is defined
- result.diff.before is defined
- "result.state == 'file'"