ansible/ansible — pull request #7575 by rstrox (2014-05-27 21:42:27+00:00)
Title: Encode metadata value to avoid double quoting

Using vars_prompt with the rax module creates metadata with extraneous u'' markup. Using self.encode() instead of repr() fixed the issue for me.

*Example playbook:*
```
#!/usr/bin/env ansible-playbook
---
- name: Build Cloud Server
hosts: localhost
gather_facts: false
vars_prompt:
p_groups: "groups?"

tasks:
- name: "Server build request"
local_action:
module: "rax"
credentials: "~/.rackspace_cloud_credentials"
region: "DFW"
name: "rstrox-{{ p_name }}"
flavor: performance1-2
image: "Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)"
key_name: rstrox-key
wait: yes
state: present
meta:
groups: "{{ p_groups }}"
register: rax
```

*Example result, rstrox-metadata's metadata was set by rax module.*

```
% supernova $ACCOUNT list --fields 'name,metadata'
+--------------------------------------+--------------------+-------------------------------+
| ID | Name | Metadata |
+--------------------------------------+--------------------+-------------------------------+
| 719517b1-3183-4a86-b8de-xxxxxxxxxxxx | rstrox-esearch-1 | {u'groups': u'elasticsearch'} |
| 0859097e-e4f7-48ae-a322-xxxxxxxxxxxx | rstrox-esearch-2 | {u'groups': u'elasticsearch'} |
| d50a34f7-642d-4402-a8e0-xxxxxxxxxxxx | rstrox-metadata | {u'groups': u"u'testvalue'"} |
+--------------------------------------+--------------------+-------------------------------+

```