The past few weeks I’ve been exploring Python and related libraries and packages to build an application at work. I’m an old Perl hacker, so Python and it’s strict indentation format limitations really rail on my nerves. But it’s a really powerful language, and all the tools I’m trying to work with support Python or REST APIs.

Friday, I decided the most annoying part of Python programming is it’s inability to detect common mistakes, like typos, and undefined variable names until you actually exercise the code that uses that mistyped variable name.

Back in my C programming language days, we used a program called ‘lint’ to locate obvious errors in source code before running a whole compiler. Friday, I googled python lint, and found out about ‘pylint’, which is exactly what I needed. The default configuration of pylint, enforces a strict coding style I was not used to previously, so it took me a good 5-6 hours to get my software to pass pylint with a minimum of warnings and no errors. but I find it really works well, and helps find all the issues I mostly worry about – not logic issues, I can deal with those, but syntax issues, like lines indented incorrectly (usually due to some extra tab characters where you don’t want them) or simple typos or fat fingers.

Pylint will speed up my app development, I guarantee it.

We stand at the precipice

US Vice-President Henry Wallace, April 9, 1944.

“The American fascists are most easily recognized by their deliberate perversion of truth and fact. Their newspapers and propaganda carefully cultivate every fissure of disunity… They claim to be super-patriots, but they would destroy every liberty guaranteed by the Constitution. They demand free enterprise, but are the spokesmen for monopoly and vested interest. Their final objective toward which all their deceit is directed is to capture political power so that, using the power of the state and the power of the market simultaneously, they may keep the common man in eternal subjection.”

LXC Linux Containers

I’ve been using LXC Linux Containers to host a number of OpenStack admin processes, as well as other things, like playing with Galera+MariaDB. Anyway, I thought I’d share my Bash shell scripts for container creation, management, etc. Your mileage may vary.

You’ll find them at in a shell archive.
Just run it to extract the scripts, and examine them or use them at your own risk. They do assume an LVM environment with the vgname vg1, and a btrfs filesystem mounted at /var/logdata on the lxc host.

The script creates a container, given the name, ip, mac address and lvm volume size (eg 20G). It’ll create a btrfs subvolume of /var/logdata and mount it as /var/log inside the container, for centralized logging. This script uses the base1.config file as a template for /var/lib/lxc/<containerneme>/config, and common.conf is a copy of my /etc/lxc/common.conf

The script is kind of like, except it uses the LVM snapshot feature to clones another “base” container instead of creating one from scratch. LVM snapshots are copy-on-write clones, so only things added or changed after the snapshot consume any additional disk space. You can create a base container, install 100GB of software, then make snapshots of that base, and each snapshot would have full access to all those packages, but only consume additional disk space for it’s config files, log files, and writable data files. This can be a huge space savings, but it’s saves time on configuring. If your base container already knows how to authenticate with your LDAP cluster, you might only need modify a few config files post snapshot, if individual accounts or certificates were required.

The script lists all configured containers in /var/lib/lxc, and if they are running, some additional info.

Then there’s, which is just a general management utility which takes an argument of stop, start, restart or status and operates on ALL containers. Nice when you need to fix something. Only if a container has = 1 will it be started by start, but it will shut any down it finds for stop.