带有“奇数长度字符串"的Ansible-vault错误将被删除. [英] Ansible-vault errors with "Odd-length string"
问题描述
我正在运行Ansible 1.8.2
.
我在另一个系统上创建了一个保管文件.在该系统上,它可以正常工作.
但是,当我在本地系统上运行它时,出现以下错误:
I'm running Ansible 1.8.2
.
I have a vaulted file created on another system. On that system it works without any problems.
However, when I run it on my local system I get the following error:
$» ansible-vault --debug view vars/vaulted_vars.yml
Vault password:
Traceback (most recent call last):
File "/usr/bin/ansible-vault", line 225, in main
fn(args, options, parser)
File "/usr/bin/ansible-vault", line 172, in execute_view
this_editor.view_file()
File "/usr/lib/python2.7/site-packages/ansible/utils/vault.py", line 280, in view_file
dec_data = this_vault.decrypt(tmpdata)
File "/usr/lib/python2.7/site-packages/ansible/utils/vault.py", line 136, in decrypt
data = this_cipher.decrypt(data, self.password)
File "/usr/lib/python2.7/site-packages/ansible/utils/vault.py", line 545, in decrypt
data = unhexlify(data)
TypeError: Odd-length string
ERROR: Odd-length string
我试图手动输入密码或将其复制粘贴,但是仍然会发生错误.
I tried to manually type in the password or copy-pasting it, but the error still happens.
这是怎么回事,以及如何解决此错误?
What is going on here and how to fix this error?
推荐答案
出现此错误是因为从Ansible 1.8.2开始,它需要对已存储文件进行非常特定的行尾编码.
Turns out this error is because as of Ansible 1.8.2 it requires a very specific line-end encoding for the vaulted files.
当我拥有这种类型的文件时,它将失败:
When I had this type of file it would fail:
$» file vaulted_vars.yml
vaulted_vars.yml: ASCII text, with CRLF line terminators
但是,一旦我将其更改为它,它便开始工作:
However, once I changed it to this, it started working:
$» file vaulted_vars.yml
vaulted_vars.yml: ASCII text
这是整个问题的发生,因为我的git客户端正在更改换行符.有关详细信息,请参见本文: https://help.github.com/articles/与线尾交易/
This whole problem happened because my git client was changing linefeed characters. See this article for specifics: https://help.github.com/articles/dealing-with-line-endings/
这篇关于带有“奇数长度字符串"的Ansible-vault错误将被删除.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!