Skip to content

Commit

Permalink
[stable-2.16] Issue #80267: Remove user not found warning (#80291) (#…
Browse files Browse the repository at this point in the history
…83078)

(cherry picked from commit e0bf76e)

Co-authored-by: Sebbo94BY <[email protected]>
  • Loading branch information
sivel and Sebbo94BY committed May 9, 2024
1 parent 40bdb2b commit 5d3a372
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- ansible.builtin.user - Remove user not found warning (https://github.com/ansible/ansible/issues/80267)
6 changes: 0 additions & 6 deletions lib/ansible/modules/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -1063,12 +1063,6 @@ def user_exists(self):
exists = True
break

if not exists:
self.module.warn(
"'local: true' specified and user '{name}' was not found in {file}. "
"The local user account may already exist if the local account database exists "
"somewhere other than {file}.".format(file=self.PASSWORDFILE, name=self.name))

return exists

else:
Expand Down
2 changes: 0 additions & 2 deletions test/integration/targets/user/tasks/test_local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,6 @@
- name: Ensure warnings were displayed properly
assert:
that:
- local_user_test_1['warnings'] | length > 0
- local_user_test_1['warnings'] | first is search('The local user account may already exist')
- local_user_test_5['warnings'] is search("'append' is set, but no 'groups' are specified. Use 'groups'")
- local_existing['warnings'] is not defined
when: ansible_facts.system in ['Linux']
Expand Down

0 comments on commit 5d3a372

Please sign in to comment.