# v2 hacking broken?

**URL:** <https://forum.ansible.com/t/v2-hacking-broken/18788>\
**Category:** Ansible Developer\
**Created:** [July 16, 2015, 10:28pm UTC](https://forum.ansible.com/t/v2-hacking-broken/18788 "2015-07-16T22:28:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rick.mendes4](https://avatars.discourse-cdn.com/v4/letter/r/85f322/32.png) [@rick.mendes4](https://forum.ansible.com/u/rick.mendes4)\
**Post date:** [July 16, 2015, 10:28pm UTC](https://forum.ansible.com/t/v2-hacking-broken/18788/1 "2015-07-16T22:28:52Z")

</div>

I grabbed the latest sources today from the ansible repository so I could test a module. After the module tested out fine with v1, I tried testing it with v2. I ran into problems with the test-module script.

I’ll use a core module for the examples here to keep things simple.

`  
source hacking/env-setup  
hacking/test-module -m lib/ansible/modules/core/utilities/logic/set\_fact.py -a “one\_fact=something”  
Traceback (most recent call last):  
File “hacking/test-module”, line 194, in   
main()  
File “hacking/test-module”, line 178, in main  
(modfile, module\_style) = boilerplate\_module(options.module\_path, options.module\_args, options.interpreter, options.check)  
File “hacking/test-module”, line 125, in boilerplate\_module  
inject  
File “my\_user/ansible/lib/ansible/module\_common.py”, line 152, in modify\_module  
AttributeError: ‘module’ object has no attribute ‘jsonify’

`

Looking at the reference to module\_common.py, I realized that was pointing to a non-existent file. The file is now in ansible/lib/ansible/executor. I hacked the test-module script to change the import:

`import ansible.executor.module_common as module_common`

That exposed a new problem.

`  
hacking/test-module -m lib/ansible/modules/core/utilities/logic/set\_fact.py -a “one\_fact=something”  
Traceback (most recent call last):  
File “hacking/test-module”, line 194, in   
main()  
File “hacking/test-module”, line 178, in main  
(modfile, module\_style) = boilerplate\_module(options.module\_path, options.module\_args, options.interpreter, options.check)  
File “hacking/test-module”, line 92, in boilerplate\_module  
replacer = module\_common.ModuleReplacer()  
AttributeError: ‘module’ object has no attribute ‘ModuleReplacer’

`

I can only find ModuleReplacer in the v1 module\_common.py file.

This is giving me the feeling the v2 scripts need some attention as they look like they may still be half baked as v1.

Should we open a bug for this?

Thanks.

---

<div class="post-metadata">

**Author:** ![rick.mendes4](https://avatars.discourse-cdn.com/v4/letter/r/85f322/32.png) [@rick.mendes4](https://forum.ansible.com/u/rick.mendes4)\
**Post date:** [July 16, 2015, 11:42pm UTC](https://forum.ansible.com/t/v2-hacking-broken/18788/2 "2015-07-16T23:42:50Z")

</div>

These issues have already been fixed. Thanks for the quick turn around!

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [July 16, 2015, 11:49pm UTC](https://forum.ansible.com/t/v2-hacking-broken/18788/3 "2015-07-16T23:49:22Z")

</div>

i believe there are still issues left, but we'll get to it soon

---

<div class="post-metadata">

**Author:** ![Gerard\_Lynch](https://avatars.discourse-cdn.com/v4/letter/g/958977/32.png) [@Gerard\_Lynch](https://forum.ansible.com/u/Gerard_Lynch)\
**Post date:** [July 17, 2015, 11:29am UTC](https://forum.ansible.com/t/v2-hacking-broken/18788/4 "2015-07-17T11:29:50Z")

</div>

There is a ticket currently open for devel hacking/test-module - see [https://github.com/ansible/ansible/issues/11619](https://github.com/ansible/ansible/issues/11619)
