-
Notifications
You must be signed in to change notification settings - Fork 23.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
User - Create parent directories if they do not exist in the specified home path #51043
User - Create parent directories if they do not exist in the specified home path #51043
Conversation
e3a4dfa
to
95b921a
Compare
95b921a
to
bcfd5c2
Compare
bot_status |
Componentschangelogs/fragments/user-home-dir-with-no-parents.yaml lib/ansible/modules/system/user.py test/integration/targets/user/tasks/main.yml test/integration/targets/user/vars/main.yml Metadatawaiting_on: ansible |
bcfd5c2
to
5c906de
Compare
The useradd command line tool does not create parent directories. Check if the specified home path has parents that do not exist. If so, create them prior to running useradd, then set the proper permission on the created directory. Add tests Signed-off-by: Sam Doran <sdoran@redhat.com>
Signed-off-by: Sam Doran <sdoran@redhat.com>
5c906de
to
bb53911
Compare
rebuild_merge |
… the specified home path (ansible#51043) * Create a user home directory if it has parents that do not exist The useradd command line tool does not create parent directories. Check if the specified home path has parents that do not exist. If so, create them prior to running useradd, then set the proper permission on the created directory. Add tests Signed-off-by: Sam Doran <sdoran@redhat.com> * Use dict for default user group in tests Signed-off-by: Sam Doran <sdoran@redhat.com> * Fix tests Signed-off-by: Sam Doran <sdoran@redhat.com> (cherry picked from commit d2edf1d) Co-authored-by: Sam Doran <sdoran@redhat.com>
Fixes ansible#60307. This bug was introduced in commit d2edf1d ("User - Create parent directories if they do not exist in the specified home path (ansible#51043)") and did not make it into any releases. (cherry picked from commit c71622b)
Fixes ansible#60307. This bug was introduced in commit d2edf1d ("User - Create parent directories if they do not exist in the specified home path (ansible#51043)") and did not make it into any releases.
SUMMARY
Fixes #41393
The
useradd
command line tool does not create parent directories. The PR checks if the specified home path has parents that do not exist. If so, create them prior to runninguseradd
, then set the proper permission on the created directory.This would fail on the first run because the code it was hitting only checked for missing home directories when the user account existed. The first run code was relying on
useradd
to create the home directory if it didn't exist, which it usually does. But when parent directories do not exist,useradd
simply fails to create the home directory though it does create the account on the system.Also add integration tests.
Signed-off-by: Sam Doran sdoran@redhat.com
ISSUE TYPE
COMPONENT NAME
user.py