template hellivision

| | Comments (0) | TrackBacks (0)

I'm seeing erb template hell in front of my eye. It's really cool to be able to flip a value in a ruby template file, but how do you pre-flight just the one file? And, how do you use a library function in the template helpers?

I've tried moving my 'xml-escape this text' function into libraries, but can never seem to import it (using either Chef::Recipe.send(:include) or Chef::Resource::Resourcename.send(:include). And, the native erb expander syntax (say, <%= h(text) %>) apparently wasn't compiled in. So, that shortcut is gone. I just make helper inline blocks that map a variable to a name, and keep rewriting code to xml escape things there.

Also, there is so much java serialization crazy going on in these config files: it would make way more sense to build these classes dynamically through introspection and some kind of java/ruby bridge. Why not just load all the classes into an uber classpath, set the values, and poop out the config files? Using the groovy cli is half the way there, I guess. As long as the service is up and hasn't exploded. I didn't go whole hog groovy, since manipulating straight text is easier for me.

Also entertaining is crawling through every setting, and taking the .xml file with the saved value, and reverse engineering where the setting is from. Oh. And java enums instead of serialized strings. I love saving random ints into files, and keeping my own hash lookups. That's not fragile at all.

Then, the next day, I complete my templates for configuration, except for jobs. And, how to handle upgrade/rollback of jobs. (configuration is, in theory, selecting an older previous cookbook, or setting an attribute on the slave node back). Except, the transition needs to be tested. And, hey. How about checking in all the source, and pumping through continuous integration into chef-server? AAAAAAAAHHH!

Except, work is going to be asking me to pull a 180 the next few weeks to move onto another task, and only the linux staging slave is connected. I need recipes for managing slaves, especially windows where the direction of slave creation is reversed (slave subscribes to master, as opposed to the other way round). How is that even a good design decision? Shouldn't there have been a new mechanism for attaching to windows slaves, that works in the same direction? Whatever. It's all one big pile of recipes now!

Let's see how much ruby/chef I forget in the next 2 weeks.

0 TrackBacks

Listed below are links to blogs that reference this entry: template hellivision.

TrackBack URL for this entry: http://skull.piratehaven.org/~epu/mt/mt-tb.cgi/175

Leave a comment

Recent Tweets