I can’t believe it’s already the end of my second month with Outreachy, now I have just a month to go! How time flies!!!
At the beginning of January, I had this plan to push a lot of changes and just do a whole lot. So far, I’ve been working on the same 4 changes! Firstly, CI might fail it, then I’d have to figure out why. Then, I’d fall into this problem with git, which by the way I have so much to learn about. Then when I do make changes and it passed CI, the reviewers see it and it’s all just wrong!
But even though, I didn’t make as much changes as I’d hoped for this month, personally I’ve learnt so much about my project, about python and generally about being a developer. I’ll try to share a few with you in this post.
This being my actual project, it only makes sense to talk about it first. So far, I have only extended and added bits of code to existing modules. I haven’t yet created any new ones, but I should create one soon, hopefully I get to do that before my internship ends.
Ansible is basically an automation tool – for automating deployment, configuration or other repetitive tasks a person/operator would have to keep doing if they were managing several machines.
An Ansible module is a standalone script run by Ansible – this means that it can be used by the Ansible API or an ansible-playbook program. This script can be written in many programming languages but I have been using python. A module is written such that it can accept arguments from the user and make changes accordingly. Often times, it would also return some information to the user via a JSON string. So what I have been doing so far is to develop some of these modules by adding more functionality for the user.
I’ve also learnt a bit about testing these modules, using an ansible-playbook called bifrost. Before this, I didn’t quite understand how a user would actually use the modules I had been working on. Now this has given a some understanding. It’s been all very interesting really, connecting the dots and basically just being aware of the many possibilities available with Ansible.
Now this has been my biggest problem so far and to be honest, I’m still trying to find my way around it. On about 2 occasions, I actually spent the whole day trying to fix a mess I made with git!
So the first thing I figured out to help myself is to create a new branch for every distinct change. So remember I said I’ve been adding functionalities to modules; I could add about three different functions that don’t affect each other to the same script. I started by working on the same branch until I saw that this caused overlaps, then things would fail when they shouldn’t. What I eventually did was to pick the latest of each change and move to a fresh branch. Next time, I’d just start on a new branch to avoid any issues.
But when your changes do affect each other, you’d have to work on the same branch. I haven’t run into that yet, but when I do, I should write a post of how I deal with it.
I also learnt about
git reset which came really useful at times and sometimes just made my problem worse! One thing to note is that you should not use it unless you’re sure you’re the only one that has made changes on a certain repo, like when you want to uncommit your last change or go back just a few changes. You can know if others have made changes with
git reflog this will show the entire log of what has been happening to that repo since you first cloned it.
There are still a lot of terms I’m trying to understand with git and I still run into errors that I honestly can’t really say what I did to get myself out! One day, when I finally figure git out, I’ll proudly write a post about it!
One step at a time
Finally, I’ve learnt that you can’t figure it all out at once and I think that’s some of the beauty of open source. One person does something as far as they know it, and then someone else with more experience or just a different perspective sees something that might not work or would break and modifies it.
When I first started, the scripts seemed so long and complex and I didn’t fully understand what was going on so I was worried about how I’d work with them. I also didn’t know how I’d spot bugs to fix. But with documentation and my mentor’s help, I figured out what was missing and what I needed to do so I worked on that to the best of my knowledge and then after reviews, I’ll keep adding more and somehow things begin to look more sensible.