Failure at Cloud & rescued by Python
Submitted by Kushal Das (@kushaldas) on Monday, 22 February 2016
Section: Full talk Technical level: Intermediate Status: Confirmed & Scheduled
This talk will go through the issues we faced in the Fedora Cloud SIG while testing the cloud imgaes, and how we solved the issues in record time with help from a programming language called ‘Python’. I hope this talk will encourage people to use more of Python as a tool to solve problems.
The Fedora Cloud SIG works to make Fedora successful on all major cloud platforms, public and private. As a community we maintain, build, and release a set of images which not only covers the standard cloud installations, but also for Vagrant users in different operating systems. Couple of
release back we had some last minute release blocking bugs which escaped our manual qa effort from the community. This talk will re-introduce Python programming language in a situation like above, and how it helped to create an efficient automated testing framework up & running.
The major points of the talk:
- Why didn’t we just write some shell scripts? What was the benifit of using Python, a full blown programming language? (Hint: think about maintaining the codebase)
- First introduction of Python as unittests. Even though we were running shell commands, and checking the output, the introduction of unittests helped even new comers to become a helping hand in the process. Showcasing the amount of flexibility unittest module provided.
- Boot -> Test -> Destroy: Moved the whole process into a Python module. (Reusability in other codebases)
- Minimal configuration:
import jsoncame to rescue. Example of trying to do the same over shell scripts.
- In cloud there is no guaranty of successful instances. We had to bring in another standard Python language
Decorator. We will see diffrent code examples about how we can use this language feature in different places.
- Just 2 week before production deployment, rel-eng team said this is not what they want. We need to test Vagrant images.
- Oops, libvirt storage failure. Have to refresh all storage volumes. Let us call another Python function.
- Remember those unittest module we talked about before? I never had to start writing tests from scratch, someone will do that even before I start writing.
- Batteries included in Python. There is a readymade Python module to do anything you want. We had to add feature to control instances over AWS. Seems to be few more lines of code.
- Total project is now around 1k lines of code, 45KB rpm size. https://tunir.rtfd.org
This talk will showcase how one can use these batteries to solve most of the problems in one’s life (or the job). I will go through the code examples as required in the talk.
Kushal Das is a core developer of CPython project. He is a long time Fedora project contributor, and currently works as Fedora Cloud Enginner in the Fedora Engineering team at Red Hat. He is also a fellow at Python Software Foundation.