Sat Aug 10 11:36:37 EDT 2019
idempotent global state
Here's something I run into a lot:
- I have some script that sets up some global state on a machine,
e.g. a network connection
- In order to make it idempotent I kill ALL instances of network setup
and replace it with the one I want.
This isn't actually idempotent in the normal sense (don't do anything
if it is already set), but is idempotent in the observable sense: make
sure something is set a certain way.
So if a check is added to not change anything if already set up we can
agree that they are basically the same. That check is just a cache.
The end result is important.
Now what I wonder: is this actually good practice? In practical linux
day-to-day work it is a lot of labour to make a proper "state
manager", but a quick and dirty "kill any other setups and replace
with desired one" is maybe acceptable?