Encryption of already encrypted files leads to error
As defined in (https://gitlab.com/Orange-OpenSource/lfn/ci_cd/chained-ci-roles/-/blob/master/get_artifacts/tasks/binary.yml#L159) the error during encryption of an already encrypted file should be ignored:
##
# If we encode file via ansible vault
##
- name: encrypt files
shell: >
ansible-vault encrypt --vault-password-file {{
lookup( 'env', 'VAULT_FILE') }} {{ item }}
register: res
loop: "{{ files_list }}"
failed_when:
res.rc == 1 and res.stderr != "ERROR! input is already encrypted"
when:
config.get_encrypt is defined and (config.get_encrypt | bool)
But it seems the STDERR message contains sometimes special characters, so the check fails:
<onap-istanbul-ta5> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1645019772.849536-213481570837950/ > /dev/null 2>&1 && sleep 0'
failed: [onap-istanbul-ta5] (item=/builds/tnap/onapcommunity/integrationproject/onapdeployment/chained-ci/FINAL_ARTIFACT/vars/vim.yml) => {
"changed": true,
"cmd": "ansible-vault encrypt --vault-password-file .vault /builds/tnap/onapcommunity/integrationproject/onapdeployment/chained-ci/FINAL_ARTIFACT/vars/vim.yml",
"delta": "0:00:01.669055",
"end": "2022-02-16 13:56:14.783688",
"failed_when_result": true,
"invocation": {
"module_args": {
"_raw_params": "ansible-vault encrypt --vault-password-file .vault /builds/tnap/onapcommunity/integrationproject/onapdeployment/chained-ci/FINAL_ARTIFACT/vars/vim.yml",
"_uses_shell": true,
"argv": null,
"chdir": null,
"creates": null,
"executable": null,
"removes": null,
"stdin": null,
"warn": true
}
},
"item": "/builds/tnap/onapcommunity/integrationproject/onapdeployment/chained-ci/FINAL_ARTIFACT/vars/vim.yml",
"msg": "non-zero return code",
"rc": 1,
"start": "2022-02-16 13:56:13.114633",
"stderr": "\u001b[0;31mERROR! input is already encrypted\u001b[0m",
"stderr_lines": [
"\u001b[0;31mERROR! input is already encrypted\u001b[0m"
],
"stdout": "",
"stdout_lines": []
}