I was once told by a good friend that “open source is all well and good, but as a “John Doe” admin what do I need the source code for? It never does admins any good to have the source.” At that time, I conceded. It probably wasn’t as valuable for admins; it was for developers who need to change the behavior of something. Admins often don’t need to change how Apache httpd runs, so sure, source access doesn’t benefit admins. But really, open source is about freedom writ large – not on a daily basis, like the right to vote.
I’m working with some Red Hat Enterprise Linux (RHEL) instances in an Amazon Web Services (AWS) EC2 instance and a Python toolkit called boto. I’m using boto (2.6.0 shipped with RHEL 6 to be pedantic) to create and manage EBS snapshots from within the instance.
Everything was running smoothly: pulling back metadata like a champ, associating volumes and the instance, creating the snapshot. Then I used a boto method called ‘trim_snapshots’. After reading through the API reference, I figured out how to put the call together (still having issues with creating a variable to hold the int values I want to pass to trim_snapshots), but I was getting no feedback or return from the call. And the 2.6.0 documentation wasn’t particularly helpful.
So I started searching and found this post which looked very similar, using trim_snapshots but no “trimming”.
As you can see the answer … not very helpful.
Unfortunately, there weren’t a lot of hits on trim_snapshots, so perhaps the post’s responder is in the majority. But I’m determined to make this work, so I look for and find the source for the trim_snapshots call here.
Ah ha! So I found that file locally and started reading. First up, I got a better understanding of the time calculations located in the very first code block. Second, we have to have names in our volumes, otherwise we don’t address those snapshots. You may say, “Well it said so in the doc,” but I didn’t read it that way. Having the code to look at and toss some local debug statements showed me the way.
Ultimately, I did go ahead and roll my own because the existing call didn’t work for what I was doing, not because I couldn’t get past the ‘None’ return when it looked like it should have worked.
There we go. As an admin, I got value from being able to see and modify the source code. I needed a better understanding than the documentation alone could provide me. The ability to find the code on github, snake some code for a test block into the local source, and really understand the function I was calling did with the parameters I was passing allowed me to use trim_snapshots instead of throwing up my hands in frustration and writing it from scratch.
To my good friend, I hereby retract my concession. Open source is as good for the admin as it is for the developer.