afgane/blend — pull request #7 by jmchilton (2012-09-28 01:41:23+00:00)
Title: Build user data with pyyaml. 

Needed for overriding properties utilizing nested data structures such as 'master_prestart_commands' and 'services'.

I understand that adding dependencies on external is sometimes a bad idea, so I have outlined some alternatives below. If you would like to accomplish this without requiring pyyaml I would be happy to submit pull request to accomplish something similar via one of these alternative methods. I do think the approach in this pull request is the cleanest though and has other upshots such as properly escaping quotations in the yaml.

One approach might be to try to import yaml but catch the import failure exception and fallback to the old method in that case (like this: https://github.com/chapmanb/cloudbiolinux/blob/master/cloudbio/biodata/genomes.py).

Alternatively, you are constructing these variables ud and ci, you could just take in another variable (say formatted_custom_ud) that the user of the blend library could build with pyyaml and blend could just concatenate that directly to the user data.