AttributeError: 'module' object has no attribute 'ModuleReplacer' when trying to create a custom module

Hi,

I am trying to create a custom module based on pyrax (rackspace) to create reverse dns entries. I followed the hacking guide but I am stuck testing the new module because of an AttributeError: ‘module’ object has no attribute ‘ModuleReplacer’ error.

My set up is as follows:

Mac OSX, installed python with brew and using pip for the dependencies. Local python is at /usr/local/bin/python. Then I following the hacking guide at http://www.ansibleworks.com/docs/developing_modules.html and checked out ansible, ran ./hacking/env-setup and than:

./hacking/test-module -m …/servers/modules/rax_dns

Output:

Traceback (most recent call last):

File “./hacking/test-module”, line 163, in

main()

File “./hacking/test-module”, line 147, in main

(modfile, module_style) = boilerplate_module(options.module_path, options.module_args)

File “./hacking/test-module”, line 84, in boilerplate_module

replacer = module_common.ModuleReplacer()

The rax_dns:

#!/usr/bin/python #changing this to /usr/local/bin/python has no effect.

import pyrax

def main():

module = AnsibleModule(

argument_spec = dict(

credentials = dict(required=True),

hostname = dict(required=True)

)

)

pyrax.set_setting(“identity_type”, “rackspace”)

pyrax.set_credential_file(credentials)

include magic from lib/ansible/module_common.py

#<<INCLUDE_ANSIBLE_MODULE_COMMON>>

main()

What am I missing? Also can I put my custom modules in my own project? Or do they need to be in the ansible directory?

Lars

Hi, as this is a question about developing modules, please post this to the ansible-devel@googlegroups.com list and we’ll help out.

Thanks!

Ok will do.

Lars