First post, by SirNickity
I've got a client that wants to use Ansible to probe network devices at a couple hundred branch office locations, and it needed a new module to do what they wanted to do. Ansible claims "you can write modules in any language that can return JSON!"
All of the code examples are in Python, though, and go something like "here's an excerpt that does X" followed by a code snippet, followed by "see how easy that is? Gosh, this is a beautiful chunk of code. I mean look at it. LOOK AT IT. Are you looking at it? I just wanna lick my screen now and taste how delicious it is."
The actual Ansible-to-module interface is basically a black box. I've found one half-@$$ed reference where the example code is still in Python, but at least describes vaguely what is passed in to the script, and what it should output. The developers strongly recommend writing new modules in Python, though, because there's a fair bit of boilerplate code that can be used by importing a class if you do, and it handles all the in/out stuff for you.
So rather than reverse-engineer the API, I decided to stick to Python. I don't know Python, I'm perl hacker, so I started learning it.
OMG you guys. It turns out ALL the Python documentation is like the above. An example or two, of whatever they thought you might find most interesting, but like nothing else. No API reference. Barely a thought given that anything you can do might fail. Absolutely no regard to what you should do if it does fail.
I've heard Python has a "better to ask for forgiveness than permission" culture regarding coding. Write everything in a Try: block and if something breaks, it'll just get caught in the next Except: block. This makes me very sad. I hope not all code is written by children too distracted by squirrels to remember to put the semicolon at the end of the line, but I fear Python's popularity might be a symptom of this very attitude. I mean, sure, code is a lot leaner when you DGAF about the outcome. (Although I absolutely disagree that this disaster of a language is any easier to read than... any sensible language.)
I need to go visit perlmonks now, just to cleanse the taste of dumpster fire out of my mouth.