Closed Fizzadar closed 2 years ago
From: https://github.com/Fizzadar/pyinfra/issues/585#issuecomment-860271266
This might be the right point to also start supporting Solaris'/Illumos' pfexec, and maybe unify the interface of using them? Instead of having various use_
login, use password, preserve _env, remove the specific name, and provide a new parameter like e.g. priv_tool that can be set to one of the supported methods. Then I could write in my deploys files.file(..., priv_tool=doas, use_priv_login=True). This way, when I adapt the deploy to another OS, or simply when I have to switch to sudo because I started to need to use some of its features, I only have change it at one point. That point could even be somewhere central, instead of in every single operation.
I'd prefer option 3 I think just because option 4 is more verbose where it doesn't need to be. On the other hand, another solution could be just to prefix like Ansible does (e.g. pyinfra_sudo_user)
_
prefixed gloal arguments is now part of v2, with backwards compatibility until v3.
Released in v2!
pyinfra has a number of global
@operation
/@deploy
arguments, these are "magic" in that they are extracted before other arguments are passed into the operation/deploy function. This means that these functions cannot use arguments with the same name as global arguments.While this works OK for builtin operations, where this issue can be managed, it's a disaster for 3rd party operations and deploys. It effectively bocks additional global arugments being added (such as
docker_user
, which would be very useful).Currently leaning towards the dict (option 3+4), with the final option style wise, only because it's easier to read (IMO, very subjective) and is the closest match to the current way.