带有“奇数字符串”的Ansible

编程入门 行业动态 更新时间:2024-10-19 20:41:29
带有“奇数字符串”的Ansible-vault错误(Ansible-vault errors with “Odd-length string”)

我正在运行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 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开始,它需要一个非常特定的用于拱形文件的行端编码。

当我有这种类型的文件时,它会失败:

$» 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 terminators

However, once I changed it to this, it started working:

$» file vaulted_vars.yml vaulted_vars.yml: ASCII text

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/

更多推荐

本文发布于:2023-08-01 15:02:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1359211.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:奇数   字符串   Ansible

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!