Fact Caching doesn't appear to save all facts

I wrote a custom fact which sits on a server and pulls out an array of supervisord programs:

`

#!/usr/bin/env python2.7

import os
import sys
import json

Config to read

supervisord_config = ‘/etc/supervisord.conf’;

Define the main function

def main():
file_object = open(supervisord_config, ‘r’);

program_list = ;

for line in file_object:
if “programs” not in line:
if “program:” in line:
programs = line.split(“:”)[1];
programs = programs.split(“]”)[0];
program_list.append(programs);

print json.dumps(program_list);

Run the main function

if os.path.exists(supervisord_config):
main()
else:
sys.exit(1)

`

Running the setup module against the server, to be able to access the facts, this the above returns:

`

“ansible_local”: {
“supervisord_default”: [
“imageprocess”,
“replaceimage”,
“mobile_imageprocess”,
“mobile_replaceimage”
],
},

`

That is correct and i can manipulate the output within tasks and templates perfectly, however i require one template to utilise facts from other servers and so i wanted to utilise the fact_caching functionality, however the above fact doesnt appear to be stored properly in the cache:

`
“supervisord_default”: {},

`

That is all that the cache has…

How can i get it so that the cache has the correct data?