pyinfra-dev / pyinfra

pyinfra turns Python code into shell commands and runs them on your servers. Execute ad-hoc commands and write declarative operations. Target SSH servers, local machine and Docker containers. Fast and scales from one server to thousands.
https://pyinfra.com
MIT License
3.85k stars 374 forks source link

Use distro information in `server.packages` (apt would be picked over zypper) #799

Open brejoc opened 2 years ago

brejoc commented 2 years ago

https://github.com/Fizzadar/pyinfra/blob/c1c9437716c847f24d032543443ad7f483ac0931/pyinfra/operations/server.py#L520-L521

While this should work in general, I think this might deliver surprising results for example for openSUSE. An openSUSE install is shipping aptitude with a symlink to apt. But apt might behave different from zypper, which most people would expect to be invoked in this case.

Checking the distribution version with distro might deliver more reliable results.

Fizzadar commented 2 years ago

Hi @brejoc! Thank you for reporting this, indeed zypper should be preferred on openSUSE. The issue with distro mapping is maintenance, although perhaps a combination of mapping with fallback as existing makes sense.

I'm going to push a quick fix for this as-is by re-ordering so zypper is preferred and leave this issue open to track the distro based improvement.