/images/avatar_ro.png

Back 2 Code

Pytest System Report

In a previous article, I introduced a simple way to perform system checks with pytest + testinfra . Here it is a simple variant of the same principle with the intention of producing a short human readable report about system configuration. The goal is to get and report quickly some value of interests from a system (a host).

Linux install command

I did not know the Linux install command before.

This install program copies files (often just compiled) into destination locations you choose.

Let’s see how it can be useful.

The with statement

The with statement in Python allows the execution of a block of code inside a context manager responsible of the initialization and the finalization code. It is often used in the standard library and one of the most frequent usage is for interacting with files. The context manager is responsible of the file lifecycle: initialization code is responsible of opening the file while the finalization code is responsible of closing it. It’s common and convenient to use with statement, but it can be interesting to define our own implementation for dedicated tasks like running a Docker container. Let’s check how to do it.

Postmortem

Recently big outages have occurred impacting two of the main cloud vendors

highlighting the importance of a process dedicated to analyse the incidents or outage in the aim of knowing what happened and why, but above all to learn and take appropriate actions in order to avoid the same problems to occur again. This process is called postmortem — or post mortem in two words.

Global gitignore

Here is a short but very useful tip to avoid committing unwanted files by configuring a gitignore at global level. The main advantage is that it’s configured once for all and you don’t have to do it on each project.

Linux startup scripts

When it comes to perform customization to startup scripts in order to initialize or tune something, it’s not obvious to pick the right startup file. The way the system is reading startup files depends on the context and mainly if the shell is

  • Interactive / non-interactive shell
  • Login / non-login shell

APT usage in Docker images

When packages are installed in a Dockerfile through APT (Debian, Ubuntu) you should comply with some best practices. One of the main reason is to try to keep the image as as small as possible, but it’s not the only one. Let’s examine a typical snippet of package’s installation.

Skeletal profiles

Sample startup files are traditionally kept in /etc/skel. If you customize your systems' startup file examples, /usr/local/etc/skel is a reasonable place to put the modified copies.1

Pytest smoke testing

It’s a good practice to test that some prerequisites are met before going further. This practice is sometimes called Smoke testing. When you have to setup an infrastructure either on a host or in docker images. In this case Pytest + testinfra is a terrific combo to perform this kind of testing.

Data Deprecation in R-package

After my recent article on marking deprecated code in R, I had the same problem on R data package. Unfortunately I was not able to find a convenient out-of-the-box solution, see this question on SO.

So after a first draft, I’ve applied a process that seems to be a reasonable–good enough–solution.

Too many categories

By using the same fun analysis as in my previous article, I would like too highlight a problem that often occurs, dealing with too much categories (or factors as they are called in R) avoid to see clearly the big pictures.

Squashing Docker Images

I was wondering the effect of merging layers (squashing) on the size of an image. Now Docker provides an experimental --squash option for the build.

Rootless Podman

You might be saying to yourself, “but I have rootless containers right now with Docker - I run my docker commands as a regular user and it works all the time.” Even though you are executing the docker command line tool without root, the docker daemon is executing those requests as root on your behalf […]

A preview of running containers without root in RHEL 7.6

Zombie Processes

Zombie processes, a short definition

The first step is an orphaned process, a process that has lost his parent.

Suppose the parent process terminates, either intentionally (because the program logic has determined that it should exit), or caused by a user action (e.g. the user killed the process). What happens then to its children? They no longer have a parent process, so they become “orphaned” (this is the actual technical term).

source

Pinball Productivity

The pinball metaphor Another interesting thing in the book Elastic Leadership 1 by Roy Osherove. It’s more an anecdote, however the analogy is funny. He talks about another—quite old—book on management called Becoming a Technical Leader 2. In this book, the author, Gerald Weinberg tells a story about improving the high score at the pinball game. Here is the progress of the score along the time. Pinball score It’s easy to figure out that the progress does not follow a steady line, we can see several linear—and slow—progress, then big steps.