diff options
author | Erwin Oegema <blablaechthema@hotmail.com> | 2020-02-04 18:35:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-04 12:35:05 -0500 |
commit | 3b32f95fb39a0faf810bf3aa6024d704d99c7156 (patch) | |
tree | 0650d50175db2205ea83b996231f5fa939d6f158 /lib/ansible/modules/system/user.py | |
parent | fe454d27a1aa5386801563ffe8dde44064f84302 (diff) | |
download | ansible-3b32f95fb39a0faf810bf3aa6024d704d99c7156.tar.gz |
user - warn if "append" is set but not "groups" (#65795)
This fixes people unknowingly changing the primary group rather than adding a secondary group.
* Add integration test
Diffstat (limited to 'lib/ansible/modules/system/user.py')
-rw-r--r-- | lib/ansible/modules/system/user.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/ansible/modules/system/user.py b/lib/ansible/modules/system/user.py index 6f4b8d0b11..2fada8d0fd 100644 --- a/lib/ansible/modules/system/user.py +++ b/lib/ansible/modules/system/user.py @@ -511,6 +511,12 @@ class User(object): else: self.ssh_file = os.path.join('.ssh', 'id_%s' % self.ssh_type) + if self.groups is None and self.append: + # Change the argument_spec in 2.14 and remove this warning + # required_by={'append': ['groups']} + module.warn("'append' is set, but no 'groups' are specified. Use 'groups' for appending new groups." + "This will change to an error in Ansible 2.14.") + def check_password_encrypted(self): # Darwin needs cleartext password, so skip validation if self.module.params['password'] and self.platform != 'Darwin': |