Remix.run Logo
bmurphy1976 2 hours ago

You can write `if CHECK: do something`. There's nothing preventing that.

I've been down this path, implemented my own version of PyInfra many times over the years. I've used Ansible and my own implementations in anger. The _if param is far far far from the worst offender and it's a natural addition, especially when you are laying out a bunch of unrelated checks into something that looks more like a table.

Fizzadar an hour ago | parent [-]

This! Been trying to find the best (least worst) solution to this since 2015 when I started pyinfra. Done ast parsing/hacking, done weird context managers instead, tried rewriting statements to context managers. _if is the latest, and I think least worst, option right now.

Basically a flaw of the entire model where you write code as if executing a single host which is then executed on many in parallel, forcing the two step diff and deploy that causes this.

Funny thing is since v3 this behavior (diff then execute) is even desired with the yes prompt like terraform.