Debugging 'setup' python script

Hi,

I’m trying to use Ansible to setup a Raspberry Pi. Somewhere during the “setup phase” an exception is thrown:

fatal: [192.168.x.x] => failed to parse: Traceback (most recent call last):

File “/home/pi/.ansible/tmp/ansible-1341394591.63-194378702522991/setup”, line 351, in

for (k, v) in ansible_facts().items():

File “/home/pi/.ansible/tmp/ansible-1341394591.63-194378702522991/setup”, line 307, in ansible_facts

get_virtual_facts(facts)

File “/home/pi/.ansible/tmp/ansible-1341394591.63-194378702522991/setup”, line 211, in get_virtual_facts

facts = get_linux_virtual_facts(facts)

File “/home/pi/.ansible/tmp/ansible-1341394591.63-194378702522991/setup”, line 191, in get_linux_virtual_facts

if ‘QEMU’ in facts[‘processor’][0]:

KeyError: ‘processor’

I’m now wondering how I could debug this problem. I can log in to the Pi and I do have the setup file. But I don’t know how to proceed from there. I have tried loading the file and calling a function like so:
$ python -c ‘import imp; setup = imp.load_source(“setup”, “/home/pi/.ansible/tmp/ansible-1341394591.63-194378702522991/setup”); print setup.ansible_facts();’

To no avail. Could someone point me in the right direction?

With kind regards,

The problem is (at least in) in the get_cpu_facts function because various files in /proc being substantially different than the OSes people are using Ansible on already.

(I'm not surprised, first time I've heard anyone using Ansible on a Pi.)

Shouldn't be hard to fix, you may wish to try checking out the ansible source on your Pi (or rsync the files, etc) and run ./hacking/test-module to iterate over the setup module until it works
completely. I don't have access to a Pi, so you're probably the best one to do it!

Having it detect the distribution and deciding not to do certain parts of the fact code is probably fine -- I am guessing you don't need many of the variables that it generates at all.

(For what it's worth, when you say you "have" the setup file, you have the module, but you don't have the output, because it didn't run successfully)