Bug 1679254 - [abrt] ansible: default(): encoder.py:179:default:TypeError: Object of type AnsibleVaultEncryptedUnicode is not JSON serializable
Summary: [abrt] ansible: default(): encoder.py:179:default:TypeError: Object of type A...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: ansible
Version: 29
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Kevin Fenzi
QA Contact: Fedora Extras Quality Assurance
URL: https://retrace.fedoraproject.org/faf...
Whiteboard: abrt_hash:b790aebf72efa297958641beb62...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-02-20 17:52 UTC by Brant Evans
Modified: 2019-11-11 17:39 UTC (History)
5 users (show)

Fixed In Version: ansible-2.8.6-1.fc31 ansible-2.8.6-1.fc29
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-11-06 13:45:02 UTC


Attachments (Terms of Use)
File: backtrace (1.21 KB, text/plain)
2019-02-20 17:52 UTC, Brant Evans
no flags Details
File: cgroup (345 bytes, text/plain)
2019-02-20 17:52 UTC, Brant Evans
no flags Details
File: cpuinfo (1.42 KB, text/plain)
2019-02-20 17:52 UTC, Brant Evans
no flags Details
File: environ (6.84 KB, text/plain)
2019-02-20 17:52 UTC, Brant Evans
no flags Details
File: mountinfo (4.25 KB, text/plain)
2019-02-20 17:52 UTC, Brant Evans
no flags Details
File: namespaces (129 bytes, text/plain)
2019-02-20 17:52 UTC, Brant Evans
no flags Details
File: open_fds (469 bytes, text/plain)
2019-02-20 17:52 UTC, Brant Evans
no flags Details

Description Brant Evans 2019-02-20 17:52:13 UTC
Description of problem:
running an ansible playbook with a debug task. The previous task succeeds before the debug task fails. The debug task runs successfully if the ansible_password variable is in plaintext, but if a vault string is used then the task fails

Example playbook:

---
- name: facts
  hosts: nxos
  gather_facts: false
  tasks:
    - name: facts task
      nxos_facts:
        gather_subset: all
      register: switch_facts

    - name: debug
      debug:
        var: switch_facts.ansible_net_interfaces



group_vars/nxos.yml
---
ansible_connection: network_cli
ansible_network_os: nxos
ansible_user: admin
ansible_password: !vault |
          $ANSIBLE_VAULT;1.1;AES256
          33333331326439366162623437316562633834306630356366306464356536366437303963643639
          3162623838623362316565663031353339353731316437630a653936313932386333356139313766
          39343064313635396634633837636666316430363562616337633161323633633739393235633462
          3832383266316263320a356631656566653366643830303838636332386636326432303830666463
          3536


Version-Release number of selected component:
ansible-2.7.7-1.fc29

Additional info:
reporter:       libreport-2.10.0
cmdline:        /usr/bin/python3 /usr/bin/ansible-connection 8480
crash_function: default
exception_type: TypeError
executable:     /usr/bin/ansible-connection
interpreter:    python3-3.7.2-4.fc29.x86_64
kernel:         4.20.8-200.fc29.x86_64
runlevel:       N 5
type:           Python3
uid:            4400

Truncated backtrace:
encoder.py:179:default:TypeError: Object of type AnsibleVaultEncryptedUnicode is not JSON serializable

Traceback (most recent call last):
  File "/usr/bin/ansible-connection", line 328, in <module>
    main()
  File "/usr/bin/ansible-connection", line 294, in main
    conn.set_options(var_options=variables)
  File "/usr/lib/python3.7/site-packages/ansible/module_utils/connection.py", line 167, in __rpc__
    response = self._exec_jsonrpc(name, *args, **kwargs)
  File "/usr/lib/python3.7/site-packages/ansible/module_utils/connection.py", line 144, in _exec_jsonrpc
    data = json.dumps(req)
  File "/usr/lib64/python3.7/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib64/python3.7/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib64/python3.7/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib64/python3.7/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type AnsibleVaultEncryptedUnicode is not JSON serializable

Local variables in innermost frame:
self: <json.encoder.JSONEncoder object at 0x7f4b7b16e908>
o: 'redhat'

Comment 1 Brant Evans 2019-02-20 17:52:16 UTC
Created attachment 1536799 [details]
File: backtrace

Comment 2 Brant Evans 2019-02-20 17:52:17 UTC
Created attachment 1536800 [details]
File: cgroup

Comment 3 Brant Evans 2019-02-20 17:52:18 UTC
Created attachment 1536801 [details]
File: cpuinfo

Comment 4 Brant Evans 2019-02-20 17:52:19 UTC
Created attachment 1536802 [details]
File: environ

Comment 5 Brant Evans 2019-02-20 17:52:20 UTC
Created attachment 1536803 [details]
File: mountinfo

Comment 6 Brant Evans 2019-02-20 17:52:21 UTC
Created attachment 1536804 [details]
File: namespaces

Comment 7 Brant Evans 2019-02-20 17:52:22 UTC
Created attachment 1536805 [details]
File: open_fds

Comment 8 Kevin Fenzi 2019-02-20 21:36:31 UTC
Would you be willing to file this upstream at github? 

Or would you prefer I do so?

Comment 9 Brant Evans 2019-02-22 21:13:07 UTC
I've filed the issue upstream. 

https://github.com/ansible/ansible/issues/52860

Comment 10 Fedora Update System 2019-10-29 17:14:12 UTC
FEDORA-2019-355f9240c5 has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2019-355f9240c5

Comment 11 Fedora Update System 2019-10-29 17:14:18 UTC
FEDORA-2019-5f9a9b20f3 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-5f9a9b20f3

Comment 12 Fedora Update System 2019-10-30 01:19:54 UTC
ansible-2.8.6-1.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-a9195834a9

Comment 13 Fedora Update System 2019-10-30 01:34:22 UTC
ansible-2.8.6-1.fc31 has been pushed to the Fedora 31 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-355f9240c5

Comment 14 Fedora Update System 2019-10-30 02:40:30 UTC
ansible-2.8.6-1.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-5f9a9b20f3

Comment 15 Ben Cotton 2019-10-31 18:43:08 UTC
This message is a reminder that Fedora 29 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 29 on 2019-11-26.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '29'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 29 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 16 Fedora Update System 2019-11-02 18:57:41 UTC
FEDORA-2019-355f9240c5 has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2019-355f9240c5

Comment 17 Fedora Update System 2019-11-02 18:58:15 UTC
FEDORA-2019-a9195834a9 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-a9195834a9

Comment 18 Fedora Update System 2019-11-02 18:58:37 UTC
FEDORA-2019-5f9a9b20f3 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-5f9a9b20f3

Comment 19 Fedora Update System 2019-11-04 02:09:22 UTC
ansible-2.8.6-1.fc30, ansible-lint-4.1.1a0-4.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-a9195834a9

Comment 20 Fedora Update System 2019-11-04 02:18:11 UTC
ansible-2.8.6-1.fc31, ansible-lint-4.1.1a0-4.fc31 has been pushed to the Fedora 31 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-355f9240c5

Comment 21 Fedora Update System 2019-11-04 04:12:39 UTC
ansible-2.8.6-1.fc29, ansible-lint-4.1.1a0-4.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-5f9a9b20f3

Comment 22 Fedora Update System 2019-11-06 13:45:02 UTC
ansible-2.8.6-1.fc31, ansible-lint-4.1.1a0-4.fc31 has been pushed to the Fedora 31 stable repository. If problems still persist, please make note of it in this bug report.

Comment 23 Fedora Update System 2019-11-11 17:39:34 UTC
ansible-2.8.6-1.fc29, ansible-lint-4.1.1a0-4.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.