ansible/test-module produces this result: modify_module() got multiple values for keyword argument 'task_vars'

48 views
Skip to first unread message

sess...@gmail.com

unread,
Apr 16, 2018, 2:55:41 PM4/16/18
to Ansible Project
I used the test-module script to debug modules in ansible but i am getting a strange error:

1 Here is the example i followed: 

2. 
So i executed this command

ansible/hacking/test-module -I ansible_python_interpreter=/usr/bin/python -m ./custom_modules/timetest.py 

BUT I am getting this error :

[vagrant@db3 vagrant]$ ansible/hacking/test-module -I ansible_python_interpreter=/usr/bin/python -m ./custom_modules/timetest.py 
Traceback (most recent call last):
  File "ansible/hacking/test-module", line 270, in <module>
    main()
  File "ansible/hacking/test-module", line 251, in main
    (modfile, modname, module_style) = boilerplate_module(options.module_path, options.module_args, interpreters, options.check, options.filename)
  File "ansible/hacking/test-module", line 154, in boilerplate_module
    task_vars=task_vars
TypeError: modify_module() got multiple values for keyword argument 'task_vars'


Here is details my ansible 

[vagrant@db3 vagrant]$ ansible --version
ansible 2.5.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/vagrant/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Aug  4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]


When i checked the modify_module function in module_common.py i see that task_vars is in position 4

def modify_module(module_name, module_path, module_args, task_vars=None, templar=None, module_compression='ZIP_STORED', async_timeout=0, become=False,
become_method=None, become_user=None, become_password=None, become_flags=None, environment=None):


but when it is used in the test-module it is not on position 4  but Templar is:

    (module_data, module_style, shebang) = module_common.modify_module(
        modname,
        modfile,
        complex_args,
        Templar(loader=loader),
        task_vars=task_vars
    )


Please is this a bug? and if it is, how to make this work?

Regards,
Sessy
Reply all
Reply to author
Forward
0 new messages