From 5d3a372ef6db5a732e45f65625d68d6b166c8e3a Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Thu, 9 May 2024 11:05:01 -0600 Subject: [PATCH] [stable-2.16] Issue #80267: Remove user not found warning (#80291) (#83078) (cherry picked from commit e0bf76e) Co-authored-by: Sebbo94BY --- ...7-ansible_builtin_user-remove-user-not-found-warning.yml | 2 ++ lib/ansible/modules/user.py | 6 ------ test/integration/targets/user/tasks/test_local.yml | 2 -- 3 files changed, 2 insertions(+), 8 deletions(-) create mode 100644 changelogs/fragments/80267-ansible_builtin_user-remove-user-not-found-warning.yml diff --git a/changelogs/fragments/80267-ansible_builtin_user-remove-user-not-found-warning.yml b/changelogs/fragments/80267-ansible_builtin_user-remove-user-not-found-warning.yml new file mode 100644 index 00000000000..6bff3c000d8 --- /dev/null +++ b/changelogs/fragments/80267-ansible_builtin_user-remove-user-not-found-warning.yml @@ -0,0 +1,2 @@ +minor_changes: + - ansible.builtin.user - Remove user not found warning (https://github.com/ansible/ansible/issues/80267) diff --git a/lib/ansible/modules/user.py b/lib/ansible/modules/user.py index 6d465b04d07..91a702e123d 100644 --- a/lib/ansible/modules/user.py +++ b/lib/ansible/modules/user.py @@ -1063,12 +1063,6 @@ class User(object): 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: diff --git a/test/integration/targets/user/tasks/test_local.yml b/test/integration/targets/user/tasks/test_local.yml index 217d4769019..c49ab0c35c8 100644 --- a/test/integration/targets/user/tasks/test_local.yml +++ b/test/integration/targets/user/tasks/test_local.yml @@ -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']