Repository: ansible/ansible-modules-extras

Issue:
rabbitmq_user fails when no password provided
Even though the `password` param is specified as optional, the `rabbitmq_user` module fails when it is not provided.

```
Stacktrace:
  File "<stdin>", line 1595, in <module>
  File "<stdin>", line 240, in main
  File "<stdin>", line 165, in add
  File "<stdin>", line 131, in _exec
  File "<stdin>", line 1448, in run_command
  File "/usr/lib/python2.7/posixpath.py", line 261, in expanduser
    if not path.startswith('~'):
AttributeError: 'NoneType' object has no attribute 'startswith'
```

The bug is [right here](https://github.com/ansible/ansible-modules-extras/blob/a0df36c6ab257281cbaae00b8a4590200802f571/messaging/rabbitmq_user.py#L165). I might  send a PR when I get the time to fork and test.



Discussion:
# Can You Help Us Out?

Thanks for filing a ticket! I am the friendly GitHub Ansibot. 

It looks like you might not have filled out the issue description based on our standard issue template.  You might not have known about that, and that's ok too, we'll tell you how to do it.

We have a standard template because Ansible is a really busy project and it helps to have some standard information in each ticket, and GitHub doesn't yet provide a standard facility to do this like some other bug trackers.  We hope you understand as this is really valuable to us!. 

Solving this is simple: please copy the contents of this [template](https://raw.githubusercontent.com/ansible/ansible/devel/ISSUE_TEMPLATE.md) and **paste it into the description** of your ticket.  That's it!

# If You Had A Question To Ask Instead

If you happened to have a "how do I do this in Ansible" type of question, that's probably more of a user-list question than a bug report, and you should probably ask this question on the project mailing list instead.  

However, if you think you have a bug, the report is the way to go!  We definitely want all the bugs filed :)  Just trying to help!

# About Priority Tags

Since you're here, we'll also share some useful information at this time.

In general tickets will be assigned a priority between P1 (highest) and P5, and then worked in priority order. We may also have some follow up questions along the way, so keeping up with follow up comments via GitHub notifications is a good idea.

Due to large interest in Ansible, humans may not comment on your ticket immediately.  

# Mailing Lists

If you have concerns or questions, you're welcome to stop by the ansible-project or ansible-development mailing lists, as appropriate.  Here are the links:
- https://groups.google.com/forum/#!forum/ansible-project - for discussion of bugs and how-to type questions
- https://groups.google.com/forum/#!forum/ansible-devel - for discussion on how to implement a code change, or feature brainstorming among developers

Thanks again for the interest in Ansible!


Resolving patch:
diff --git a/messaging/rabbitmq_user.py b/messaging/rabbitmq_user.py
--- a/messaging/rabbitmq_user.py
+++ b/messaging/rabbitmq_user.py
@@ -162,7 +162,11 @@ def _get_permissions(self):
         return dict()
 
     def add(self):
-        self._exec(['add_user', self.username, self.password])
+        if self.password is not None:
+            self._exec(['add_user', self.username, self.password])
+        else
+            self._exec(['add_user', self.username, ''])
+            self._exec(['clear_password', self.username])
 
     def delete(self):
         self._exec(['delete_user', self.username])


Test patch: