From e0bf76e3db3e007d039a0086276d35c28b90ff04 Mon Sep 17 00:00:00 2001 From: Sebbo94BY Date: Thu, 23 Nov 2023 15:25:35 +0100 Subject: [PATCH] Issue #80267: Remove user not found warning (#80291) Co-authored-by: Sebi94nbg --- ...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 e76e3800d8a..e896581dd11 100644 --- a/lib/ansible/modules/user.py +++ b/lib/ansible/modules/user.py @@ -1070,12 +1070,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']