Skip to content

Commit 88ba3f4

Browse files
committed
Alter encoder to share structure with Ansible core
1 parent 0afb0ea commit 88ba3f4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ansible_runner/display_callback/events.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ class AnsibleJSONEncoderLocal(json.JSONEncoder):
4242

4343
def default(self, o):
4444
if getattr(o, 'yaml_tag', None) == '!vault':
45-
return o.data
45+
encrypted_form = o._ciphertext
46+
if isinstance(encrypted_form, bytes):
47+
encrypted_form = encrypted_form.decode('utf-8')
48+
return {'__ansible_vault': encrypted_form}
4649
elif isinstance(o, (datetime.date, datetime.datetime)):
4750
return o.isoformat()
4851
return super(AnsibleJSONEncoderLocal, self).default(o)

0 commit comments

Comments
 (0)