Skip to content
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

Removed boolean parameter setting from user module. #578

Merged
merged 1 commit into from
Jul 11, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 8 additions & 4 deletions library/user
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ def add_user_info(kwargs):
def user_del(user, **kwargs):
cmd = [USERDEL]
for key in kwargs:
if key == 'force' and kwargs[key]:
if key == 'force' and kwargs[key] == 'yes':
cmd.append('-f')
elif key == 'remove' and kwargs[key]:
elif key == 'remove' and kwargs[key] == 'yes':
cmd.append('-r')
cmd.append(user)
p = subprocess.Popen(cmd, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
Expand Down Expand Up @@ -287,8 +287,8 @@ password = params.get('password', None)

# ===========================================
# following options are specific to userdel
force = params.get('force', False)
remove = params.get('remove', False)
force = params.get('force', 'no')
remove = params.get('remove', 'no')

# ===========================================
# following options are specific to useradd
Expand All @@ -307,6 +307,10 @@ if system not in ['yes', 'no']:
fail_json(msg='invalid system')
if append not in [ 'yes', 'no' ]:
fail_json(msg='invalid append')
if force not in ['yes', 'no']:
fail_json(msg="invalid option for force, requires yes or no (defaults to no)")
if remove not in ['yes', 'no']:
fail_json(msg="invalid option for remove, requires yes or no (defaults to no)")
if name is None:
fail_json(msg='name is required')

Expand Down