Repository: ansible/ansible

Issue:
eos_user getting a warning for username and password

##### ISSUE TYPE
 - Bug Report

##### COMPONENT NAME
modules/network/eos/eos_user.py

##### ANSIBLE VERSION
```
ansible 2.4.0 (fix-aos-login-port 395d4d4c5b) last updated 2017/05/09 08:59:20 (GMT -700)
  config file = /Users/damien/projects/cloudlabs-topologies/vpod-l2-xs/ansible.cfg
  configured module search path = [u'/Users/damien/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/damien/projects/ansible/lib/ansible
  executable location = /Users/damien/projects/ansible/bin/ansible
  python version = 2.7.10 (default, Feb  6 2017, 23:53:20) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)]
```


##### OS / ENVIRONMENT
Mac OS X

##### SUMMARY
When using the module `eos_user` to change the password of an existing user, I'm getting two warning messages indicating that parameters `username` and `password` are getting deprecated. 
Based on my discussion with @gundalow, it's a mistake and these 2 parameters are valid for this module

##### STEPS TO REPRODUCE
Try to change the password of a user using `eos_user`
```yaml
    - name: Change Password for User Admin
      eos_user:
        username: "admin"
        password: "{{ new_password }}"
        update_password: always
        state: present
        provider: "{{ eoscli }}"
```

##### EXPECTED RESULTS

No warning messages related to `username` and `password`

##### ACTUAL RESULTS

```
TASK [Change Password for User Admin] *******************************************************************************************
 [WARNING]: argument username has been deprecated and will be removed in a future version

 [WARNING]: argument password has been deprecated and will be removed in a future version

changed: [vrack_2_leaf]
changed: [vrack_1_leaf]
```



Discussion:
cc @privateip @trishnaguha
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: notify --->
Thanks for investigation. 

Fix need backporting to `stable-2.3 ` I wonder if we can change the primary option name to `new_password`? And add an alias for user? 

Resolving patch:
diff --git a/lib/ansible/module_utils/eos.py b/lib/ansible/module_utils/eos.py
--- a/lib/ansible/module_utils/eos.py
+++ b/lib/ansible/module_utils/eos.py
@@ -67,9 +67,15 @@
 def check_args(module, warnings):
     provider = module.params['provider'] or {}
     for key in eos_argument_spec:
-        if key not in ['provider', 'transport', 'authorize'] and module.params[key]:
-            warnings.append('argument %s has been deprecated and will be '
-                    'removed in a future version' % key)
+        if module._name == 'eos_user':
+            if (key not in ['username', 'password', 'provider', 'transport', 'authorize'] and
+                    module.params[key]):
+                warnings.append('argument %s has been deprecated and will be '
+                        'removed in a future version' % key)
+        else:
+            if key not in ['provider', 'authorize'] and module.params[key]:
+                warnings.append('argument %s has been deprecated and will be '
+                        'removed in a future version' % key)
 
     # set argument's default value if not provided in input
     # This is done to avoid unwanted argument deprecation warning
diff --git a/lib/ansible/module_utils/nxos.py b/lib/ansible/module_utils/nxos.py
--- a/lib/ansible/module_utils/nxos.py
+++ b/lib/ansible/module_utils/nxos.py
@@ -65,8 +65,12 @@
 def check_args(module, warnings):
     provider = module.params['provider'] or {}
     for key in nxos_argument_spec:
-        if key not in ['provider', 'transport'] and module.params[key]:
-            warnings.append('argument %s has been deprecated and will be removed in a future version' % key)
+        if module._name == 'nxos_user':
+            if key not in ['password', 'provider', 'transport'] and module.params[key]:
+                warnings.append('argument %s has been deprecated and will be in a future version' % key)
+        else:
+            if key not in ['provider', 'transport'] and module.params[key]:
+                warnings.append('argument %s has been deprecated and will be removed in a future version' % key)
 
     # set argument's default value if not provided in input
     # This is done to avoid unwanted argument deprecation warning
diff --git a/lib/ansible/modules/network/eos/eos_user.py b/lib/ansible/modules/network/eos/eos_user.py
--- a/lib/ansible/modules/network/eos/eos_user.py
+++ b/lib/ansible/modules/network/eos/eos_user.py
@@ -46,6 +46,7 @@
       - The username to be configured on the remote Arista EOS
         device.  This argument accepts a stringv value and is mutually
         exclusive with the C(users) argument.
+        Please note that this option is not same as C(provider username).
   update_password:
     description:
       - Since passwords are encrypted in the device running config, this


Test patch: