Let vault lookup output unicode string. (#73571)
Until now, the lookup plugin returned a byte string. Changed this to output a unicode string instead.
This commit is contained in:
parent
bcefb6b5f1
commit
d0fda3e901
7 changed files with 26 additions and 1 deletions
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- the unvault lookup plugin returned a byte string. Now returns a real string.
|
|
@ -56,7 +56,7 @@ class LookupModule(LookupBase):
|
|||
actual_file = self._loader.get_real_file(lookupfile, decrypt=True)
|
||||
with open(actual_file, 'rb') as f:
|
||||
b_contents = f.read()
|
||||
ret.append(b_contents)
|
||||
ret.append(to_text(b_contents))
|
||||
else:
|
||||
raise AnsibleParserError('Unable to find file matching "%s" ' % term)
|
||||
|
||||
|
|
1
test/integration/targets/unvault/aliases
Normal file
1
test/integration/targets/unvault/aliases
Normal file
|
@ -0,0 +1 @@
|
|||
shippable/posix/group2
|
9
test/integration/targets/unvault/main.yml
Normal file
9
test/integration/targets/unvault/main.yml
Normal file
|
@ -0,0 +1,9 @@
|
|||
- hosts: localhost
|
||||
tasks:
|
||||
- set_fact:
|
||||
unvaulted: "{{ lookup('unvault', 'vault') }}"
|
||||
- debug:
|
||||
msg: "{{ unvaulted }}"
|
||||
- assert:
|
||||
that:
|
||||
- "unvaulted == 'foo: bar\n'"
|
1
test/integration/targets/unvault/password
Normal file
1
test/integration/targets/unvault/password
Normal file
|
@ -0,0 +1 @@
|
|||
secret
|
6
test/integration/targets/unvault/runme.sh
Executable file
6
test/integration/targets/unvault/runme.sh
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -eux
|
||||
|
||||
|
||||
ansible-playbook --vault-password-file password main.yml
|
6
test/integration/targets/unvault/vault
Normal file
6
test/integration/targets/unvault/vault
Normal file
|
@ -0,0 +1,6 @@
|
|||
$ANSIBLE_VAULT;1.1;AES256
|
||||
33386337343963393533343039333563323733646137636162346266643134323539396237646333
|
||||
3663363965336335663161656236616532346363303832310a393264356663393330346137613239
|
||||
34633765333936633466353932663166343531616230326161383365323966386434366431353839
|
||||
3838623233373231340a303166666433613439303464393661363365643765666137393137653138
|
||||
3631
|
Loading…
Reference in a new issue