v2 hacking broken?

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.

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

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

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