我正在运行Ansible 1.8.2 。 我在另一个系统上创建了一个拱形文件。 在该系统上,它没有任何问题。 但是,当我在本地系统上运行它时,出现以下错误:
$» 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'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 stringI 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开始,它需要一个非常特定的用于拱形文件的行端编码。
当我有这种类型的文件时,它会失败:
$» file vaulted_vars.yml vaulted_vars.yml: ASCII text, with CRLF line terminators但是,一旦我改变它,它开始工作:
$» file vaulted_vars.yml vaulted_vars.yml: ASCII text发生这个问题是因为我的git客户端正在改变换行字符。 有关详情,请参阅此文章: https : //help.github.com/articles/dealing-with-line-endings/
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 terminatorsHowever, once I changed it to this, it started working:
$» file vaulted_vars.yml vaulted_vars.yml: ASCII textThis 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/
更多推荐
发布评论