Bug 56562 - ansible-core: ошибка при вызове модуля to_nice_yaml
Summary: ansible-core: ошибка при вызове модуля to_nice_yaml
Status: CLOSED NOTABUG
Alias: None
Product: Sisyphus
Classification: Development
Component: ansible-core (show other bugs)
Version: unstable
Hardware: x86_64 Linux
: P5 normal
Assignee: Andrey Cherepanov
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-10-22 18:03 MSK by Новиков Арсений Сергеевич
Modified: 2025-10-23 09:39 MSK (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Новиков Арсений Сергеевич 2025-10-22 18:03:22 MSK
Стенды обновленные до Sisyphus:
ALT Workstation-11.1-x86-64
ALT KWorkstation-11.1.1-x86-64
ALT Education-11.0-kde-x86-64
ALT Education-11.0-xfce-x86-64D
ALT Server-11.0-minimal-x86-64

Версия пакета:
ansible-core-2.19.3-alt1

Шаги воспроизведения:
1. $ cat > playbook.yml <<'EOF'
- name: Test to_nice_yaml serialization
  hosts: localhost
  connection: local
  gather_facts: no

  tasks:
    - name: Make dummy result
      ansible.builtin.set_fact:
        join_result:
          rc: 0
          stdout: "joined ok"
          stderr: ""
          other: test
          omit_field: "{{ omit }}"

    - name: Output raw join_result
      ansible.builtin.debug:
        var: join_result

    - name: Output join_result with to_nice_yaml
      ansible.builtin.debug:
        msg: "{{ (join_result | combine({'stdout': omit, 'stderr': omit}) | to_nice_yaml).split('\n') }}"
EOF

2. $ echo localhost > hosts

3. $ ansible-playbook playbook.yml -i hosts

Фактический результат:
[ERROR]: Task failed: Finalization of task args for 'ansible.builtin.debug' failed: Error while resolving value for 'msg': The filter plugin 'ansible.builtin.to_nice_yaml' failed: ('cannot represent an object', <<Omit>>)

Task failed.
Origin: /home/test/test_toniceyaml.yml:20:7

18         var: join_result
19
20     - name: Output join_result with to_nice_yaml
         ^ column 7

<<< caused by >>>

Finalization of task args for 'ansible.builtin.debug' failed.
Origin: /home/test/test_toniceyaml.yml:21:7

19
20     - name: Output join_result with to_nice_yaml
21       ansible.builtin.debug:
         ^ column 7

<<< caused by >>>

Error while resolving value for 'msg': The filter plugin 'ansible.builtin.to_nice_yaml' failed: ('cannot represent an object', <<Omit>>)
Origin: /home/test/test_toniceyaml.yml:22:14

20     - name: Output join_result with to_nice_yaml
21       ansible.builtin.debug:
22         msg: "{{ (join_result | combine({'stdout': omit, 'stderr': omit}) | to_nice_yaml).split('\n') }}"
                ^ column 14

fatal: [localhost]: FAILED! => {"msg": "Task failed: Finalization of task args for 'ansible.builtin.debug' failed: Error while resolving value for 'msg': The filter plugin 'ansible.builtin.to_nice_yaml' failed: ('cannot represent an object', <<Omit>>)"}

На версии ansible-core-2.18.7-alt1 из p11 не воспроизводится.
Comment 1 Alexander Makeenkov 2025-10-23 09:39:21 MSK
https://docs.ansible.com/ansible/latest/porting_guides/porting_guide_12.html#breaking-changes

--- test_toniceyaml.yml.orig    2025-10-23 09:34:49.179140169 +0300
+++ test_toniceyaml.yml 2025-10-23 09:34:43.585147803 +0300
@@ -19,4 +19,4 @@

     - name: Output join_result with to_nice_yaml
       ansible.builtin.debug:
-        msg: "{{ (join_result | combine({'stdout': omit, 'stderr': omit}) | to_nice_yaml).split('\n') }}" 
+        msg: "{{ ({'rc': join_result.rc, 'other': join_result.other} | to_nice_yaml).split('\n') }}"