Bug 1875378

Summary: [ansible-freeipa] Printing strange characters while retrieving data to file in the vault module
Product: Red Hat Enterprise Linux 8 Reporter: Varun Mylaraiah <mvarun>
Component: ansible-freeipaAssignee: Rafael Jeffman <rjeffman>
Status: CLOSED ERRATA QA Contact: ipa-qe <ipa-qe>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.3CC: rjeffman, twoerner
Target Milestone: rcKeywords: Triaged
Target Release: 8.0Flags: pm-rhel: mirror+
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: ansible-freeipa-0.3.0-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-18 15:51:18 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Comment 1 Varun Mylaraiah 2020-09-03 12:30:13 UTC
Description of problem:
Printing strange characters while retrieving data to file in the vault module.

Version-Release number of selected component (if applicable):
ansible-freeipa-0.1.12-6.el8.noarch

How reproducible:
---
- name: Test vault
  hosts: ipaserver

  tasks:
  - name: vault module testing
    ipavault:
      ipaadmin_password: <xxxxxxxxxxx>
      name: 24stdvault
      out: "{{ ansible_env.HOME }}/vault_ret_data_file.txt"
      state: retrieved

ansible-playbook 2.9.12
  config file = /root/ansible.cfg
  configured module search path = ['/root/ansible-freeipa/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 3.6.8 (default, Aug 18 2020, 08:33:21) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]
Using /root/ansible.cfg as config file

PLAYBOOK: ret.yaml ***************************************************************************************************
1 plays in ret.yaml

PLAY [Test vault] ****************************************************************************************************

TASK [Gathering Facts] ***********************************************************************************************
task path: /root/ret.yaml:2
ok: [master.ipadomain.test]
META: ran handlers

TASK [vault module testing] ******************************************************************************************
task path: /root/ret.yaml:6
ok: [master.ipadomain.test] => {"changed": false, "vault": {"data": "��\u0017��\u00106Q�܃\u0012A\t��*�\u001eGq��\u0015\"B\\~��~Nq��\u0015W�HCA�\u0014;����\u0005��\n�"}}
META: ran handlers
META: ran handlers

PLAY RECAP ***********************************************************************************************************
master.ipadomain.test      



Actual results:
task path: /root/ret.yaml:6
ok: [master.ipadomain.test] => {"changed": false, "vault": {"data": "��\u0017��\u00106Q�܃\u0012A\t��*�\u001eGq��\u0015\"B\\~��~Nq��\u0015W�HCA�\u0014;����\u0005��\n�"}}

[root@master ~]# cat vault_ret_data_file.txt 
Vault_data_stored_in_file

Comment 2 Rafael Jeffman 2020-09-03 19:09:19 UTC
The issue is only reproducible if executing the playbook with `-v`, and it would not break the script. The data is correctly retrieved from the vault.

There is an upstream PR to fix the issue: https://github.com/freeipa/ansible-freeipa/pull/385

Comment 4 Rafael Jeffman 2020-10-14 15:38:02 UTC
Changes have been merged upstream.

Comment 9 Varun Mylaraiah 2020-12-11 11:06:37 UTC
Verified
ansible-freeipa-0.3.1-1.el8.noarch

ansible_freeipa_tests/vault_module.py::TestStandardVault::test_standard_vault_with_retrieved_datafile 
2020-12-11T07:59:57+0000 -------------------------------- live log call ---------------------------------
2020-12-11T07:59:57+0000 [pytest_multihost.host.Host.ansible.ParamikoTransport] INFO RUN ['/usr/bin/rpm', '-q', 'ansible-freeipa']
2020-12-11T07:59:57+0000 [pytest_multihost.host.Host.master.ParamikoTransport] INFO RUN ['kinit', 'admin']
2020-12-11T07:59:57+0000 [pytest_multihost.host.Host.master.ParamikoTransport] INFO RUN ['cat', 'vault_retrieved_data_file.txt']
2020-12-11T07:59:57+0000 [pytest_multihost.host.Host.ansible.ParamikoTransport] INFO WRITE inventory/vault.hosts
2020-12-11T07:59:58+0000 [pytest_multihost.host.Host.ansible.ParamikoTransport] INFO PUT vault_module.yml
2020-12-11T07:59:58+0000 [pytest_multihost.host.Host.ansible.ParamikoTransport] INFO RUN ['ansible-playbook', '--ssh-extra-args="-o StrictHostKeyChecking=no"', '-vv', '-i', 'inventory/vault.hosts', 'vault_module.yml']
2020-12-11T08:00:05+0000 [pytest_multihost.host.Host.master.ParamikoTransport] INFO RUN ['kinit', 'admin']
2020-12-11T08:00:05+0000 [pytest_multihost.host.Host.master.ParamikoTransport] INFO RUN ['cat', 'vault_retrieved_data_file.txt']
2020-12-11T08:00:05+0000 PASSED 




Based on the test result, marking the bug VERIFIED.

Comment 11 errata-xmlrpc 2021-05-18 15:51:18 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (ansible-freeipa bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2021:1860