You are expecting the input to always be a list, since strings are iterable in python it gets used as a list, try to detect if it is a string first and convert to a list if so, then it should work normally, listify function the other plugins use should do this for you.
On Tue, Jun 16, 2015 at 6:19 PM, Yasir Saleem <[email protected]> wrote: > Hi, > I am developing a lookup plugin to provide 'Mime Multi Part archive' data > to 'nova_compute module as 'user_data' > > Code is doing something similar to what is shown here > http://bazaar.launchpad.net/~cloud-utils-dev/cloud-utils/trunk/view/head:/bin/write-mime-multipart > > return from lookup plugin has every character separated by ','. Which I am > not sure where it is coming from > > like > > > ############ partial ansible console output Start ############ > TASK: [openstack-instance | set_fact ] > **************************************** > Terms: > /var/folders/hb/x94mdg1n2qdd3n2c7zn2xdfr1gn4kj/T/cloudinit-XXXXXX.vDaFsyKs/lookup_plugin_test-jump/ > ok: [lookup_plugin_test-jump] => {"ansible_facts": {"multi_part_msg": > "C,o,n,t,e,n,t,-,T,y,p,e,:, ,m,u,l,t,i,p,a,r,t,/,m,i,x,e,d,;, > ,b,o,u,n,d,a,r,y,=,\",=,=,=,=,=,=,=,=,=,=,=,=,=,=,=,0,2,2,1,2,6,1,9,6,0,0,4,5,3,7,6,2,5,8,=,= > > ############ partial ansible console output End ############ > > When I use the same code inside module I get the correct data. And it works > fine. I am trying to debug what is going inside lookup plugin. Is there a > way to debug lookup plugin? > > BTW: > > I am invoking lookup plugin as > > - set_fact: > multi_part_msg: "{{ > lookup('multipart_mime','/var/folders/hb/x94mdg1n2qdd3n2c7zn2xdfr1gn4kj/T/cloudinit-XXXXXX.vDaFsyKs/lookup_plugin_test-jump/') > }}" > > Where 'multipart_mime' is my lookup plugin, that converts the data in the > given directory to 'Mime Multi Part archive' data as needed by nova_compute > module. > > Thanks, > Yasir. > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/246f87ad-8514-49a6-8dda-5cafb0a44756%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- Brian Coca -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAJ5XC8ntgnugsKEVSM83sBd%2B%2BPNzGoMVW%2B4rgjWOv2YPvG4meg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
