# module.exit\_json doesn't parse my output correctly

**URL:** <https://forum.ansible.com/t/module-exit-json-doesnt-parse-my-output-correctly/16400>\
**Category:** Ansible Developer\
**Created:** [October 2, 2014, 10:07am UTC](https://forum.ansible.com/t/module-exit-json-doesnt-parse-my-output-correctly/16400 "2014-10-02T10:07:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Timothy\_Vandenbrande](https://avatars.discourse-cdn.com/v4/letter/t/7ab992/32.png) [@Timothy\_Vandenbrande](https://forum.ansible.com/u/Timothy_Vandenbrande)\
**Post date:** [October 2, 2014, 10:07am UTC](https://forum.ansible.com/t/module-exit-json-doesnt-parse-my-output-correctly/16400/1 "2014-10-02T10:07:14Z")

</div>

[The gist](https://gist.github.com/TimothyVandenbrande/5ba4d55f529e31f25015), here you’ll be able to find the sourcecome of my module.  
What I’m trying to do, is make a module that uses freeipa’s api to add dns record.  
Now the module does everything it should, but I keep getting a failed because my output isn’t parsed as it should.

---

<div class="post-metadata">

**Author:** ![Serge\_van\_Ginderacht](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@Serge\_van\_Ginderacht](https://forum.ansible.com/u/Serge_van_Ginderacht)\
**Post date:** [October 2, 2014, 10:27am UTC](https://forum.ansible.com/t/module-exit-json-doesnt-parse-my-output-correctly/16400/2 "2014-10-02T10:27:12Z")

</div>

That is pretty weird.

Can you have a look at the generated module in : /home/exh345/.ansible\_module\_generated ?

See if perhaps you see some weird characters? Also check the encoding of that file, I’d expect it to be plain ASCII.

Which version of ansible you used? Can you check on latest dev or another versions?

---

<div class="post-metadata">

**Author:** ![Timothy\_Vandenbrande](https://avatars.discourse-cdn.com/v4/letter/t/7ab992/32.png) [@Timothy\_Vandenbrande](https://forum.ansible.com/u/Timothy_Vandenbrande)\
**Post date:** [October 2, 2014, 10:40am UTC](https://forum.ansible.com/t/module-exit-json-doesnt-parse-my-output-correctly/16400/3 "2014-10-02T10:40:51Z")

</div>

Indeed, in the generated version, no strange characters.  
The generated file: [https://gist.github.com/TimothyVandenbrande/ec1f692a7b9ad93350db](https://gist.github.com/TimothyVandenbrande/ec1f692a7b9ad93350db)

I’m currently using ansible 1.7.1 but have the same problem on the devel and the 1.5.4 version.

Also something I discovered is when I comment ‘api.finalize()’ (line25) and let it exit just below it, it seems to give the output as it is supposed to.  
To me it looks like something in the freeipa api is interfering with the parsing modules in ansible, but unfortunately, I can’t see what or why.

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [October 2, 2014, 12:21pm UTC](https://forum.ansible.com/t/module-exit-json-doesnt-parse-my-output-correctly/16400/4 "2014-10-02T12:21:31Z")

</div>

2 things I wanted to mention, but have no specific recommendations for are:

1. The sequence ‘\u001b[?1034h’ is the ‘meta\_on’ shell escape sequence or the equivalent of pressing the ‘alt’ key
2. ‘Killed by signal 1.’ indicates that the process received a SIGHUP from an external source.

Both of these are rather odd. I wouldn’t expect that escape sequence unless something was trying to manipulate the shell, and I have no idea why the process would have received a SIGHUP from an external source.

---

<div class="post-metadata">

**Author:** ![Timothy\_Vandenbrande](https://avatars.discourse-cdn.com/v4/letter/t/7ab992/32.png) [@Timothy\_Vandenbrande](https://forum.ansible.com/u/Timothy_Vandenbrande)\
**Post date:** [October 3, 2014, 8:05am UTC](https://forum.ansible.com/t/module-exit-json-doesnt-parse-my-output-correctly/16400/5 "2014-10-03T08:05:09Z")

</div>

The killed by signal 1 happens on every action,  
but now it gets parsed, which it shouldn’t.

And I believe the 1st part (the alt key/meta\_on) is what’s bugging everything else.  
and because if you check the raw part in the test module, you’ll notice that the output is what it should be, but bugs once it gets parsed by ansible.

Now, if I run this module in my playbook with ignore\_errors: true, it does everything as designed, but it isn’t the way it should, so I’d like to fix it.  
Especially since I have a del module too with the same issues.  
(which once without errors will be made public ofcourse, since I also noticed some people asking for a dns/ipa module too)

---

<div class="post-metadata">

**Author:** ![Timothy\_Vandenbrande](https://avatars.discourse-cdn.com/v4/letter/t/7ab992/32.png) [@Timothy\_Vandenbrande](https://forum.ansible.com/u/Timothy_Vandenbrande)\
**Post date:** [October 17, 2014, 7:26am UTC](https://forum.ansible.com/t/module-exit-json-doesnt-parse-my-output-correctly/16400/6 "2014-10-17T07:26:39Z")

</div>

seems I’m not the only one clueless here…
