Skip to content

Commit

Permalink
do not specify -d for dir if dir does not exist.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonhadfield committed Aug 21, 2016
1 parent 82bb73d commit 6fa87ce
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/creds/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import io
import json
import os
import shlex
from collections import MutableSequence

Expand Down Expand Up @@ -227,7 +228,8 @@ def generate_add_user_command(proposed_user=None):
if proposed_user.gecos:
command = '{0} -c \'{1}\''.format(command, proposed_user.gecos)
if proposed_user.home_dir:
command = '{0} -d {1}'.format(command, proposed_user.home_dir)
if os.path.exists(proposed_user.home_dir):
command = '{0} -d {1}'.format(command, proposed_user.home_dir)
else:
command = '{0} -m'.format(command)
if proposed_user.shell:
Expand Down

0 comments on commit 6fa87ce

Please sign in to comment.