saltstack/salt — pull request #7889 by holmboe (2013-10-16 19:25:53+00:00)
Title: Templating refactor in virt.py

There were alot of small snippets of strings with string replace all over the place. This PR refactors the XML generation (`_gen_xml()` and `_gen_vol_xml()` for libvirt domain and volume XML-formats respectively) into using a single jinja template file per function. It will allow a better overview of the generated XML by having a look in its template file.

I have added some unit tests along the way to verify that the result is comparable to the previous output.

While there are some warts still that could make the logic and templates better, expect little of that in this PR. I have only focused on refactoring away from in-function string replace and such. And to make it easier moving forward.