# Converting lookup plugin to V2

**URL:** <https://forum.ansible.com/t/converting-lookup-plugin-to-v2/19447>\
**Category:** Ansible Developer\
**Created:** [October 6, 2015, 4:41pm UTC](https://forum.ansible.com/t/converting-lookup-plugin-to-v2/19447 "2015-10-06T16:41:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmorris](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@mmorris](https://forum.ansible.com/u/mmorris)\
**Post date:** [October 6, 2015, 4:41pm UTC](https://forum.ansible.com/t/converting-lookup-plugin-to-v2/19447/1 "2015-10-06T16:41:16Z")

</div>

Hi all,

I am trying to convert my one lookup plugin to the new V2 version and because I am not the original creator, I am at a loss for what still needs to be done.

This is what I currently have: [https://gist.github.com/MrMMorris/37c2ba9d7a4ec7d31779](https://gist.github.com/MrMMorris/37c2ba9d7a4ec7d31779)

This is the current error: [https://gist.github.com/MrMMorris/53af9bfe80464e9d995a](https://gist.github.com/MrMMorris/53af9bfe80464e9d995a)

I was told I need to use something like this: [https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/lookup/file.py#L43](https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/lookup/file.py#L43) in place of [https://gist.github.com/MrMMorris/37c2ba9d7a4ec7d31779#file-citadel-py-L63](https://gist.github.com/MrMMorris/37c2ba9d7a4ec7d31779#file-citadel-py-L63), but I am not very knowledgable python wise and am not sure how to refactor it.

Any help would be greatly appreciated. This is my only custom lookup plugin and probably the only thing preventing me from using 2.0.0 so I am willing to throw a fiver to whoever can help me refactor 🙂

Thanks,

Marcus
