Closed link2xt closed 7 months ago
My current workaround for this is creating all the groups and users at the beginning of the deploy, but this may not be possible in a structured deploy with functions calling each other.
Another unfortunate example of operation side effects impacting each other (#805), I am working on a new approach that may resolve these once and for all 🤞!
v3 fixes this, now that the first beta is out I’ll close this issue.
Describe the bug
Operation
server.user
depends on the facts about the user to choose between usinguseradd
andusermod
. If the facts about users say that user does not exist, but in fact the user exists, pyinfra effectively does nothing.To Reproduce
Create the following
deploy.py
file:Run
pyinfra -vvvv --ssh-user root example.org deploy.py
, where example.org is a freshly installed Ubuntu 22.04 VM.Expected behavior
I expect that
postfix
package is installed and then pyinfra adds the userpostfix
to the groupfoo
. Instead, pyinfra does not add the user to the group, but checks that user exists and does not executeuseradd
.It should instead run
usermod
.The solution would be to fix
apt
to update the facts about the users to include the information about the userpostfix
added by the post-install script.