gpt4 book ai didi

python - Ansible EC2 Python 错误 : ValueError: No JSON object could be decoded

转载 作者:太空狗 更新时间:2023-10-30 00:55:32 25 4
gpt4 key购买 nike

我正愉快地继续前进,一切正常,突然我从我的所有 EC2 Ansible 操作中收到错误(关于重建的警告之前就存在,不是问题):

ec2-user]# ansible -m ping -u ec2-user all
/usr/lib64/python2.6/site-packages/Crypto/Util/number.py:57: PowmInsecureWarning: Not using mpz_powm_sec. You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.
_warn("Not using mpz_powm_sec. You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.", PowmInsecureWarning)
Traceback (most recent call last):
File "/root/ansible/bin/ansible", line 194, in <module>
(runner, results) = cli.run(options, args)
File "/root/ansible/bin/ansible", line 112, in run
inventory_manager = inventory.Inventory(options.inventory, vault_password=vault_pass)
File "/root/ansible/lib/ansible/inventory/__init__.py", line 118, in __init__
self.parser = InventoryScript(filename=host_list)
File "/root/ansible/lib/ansible/inventory/script.py", line 49, in __init__
self.groups = self._parse(stderr)
File "/root/ansible/lib/ansible/inventory/script.py", line 57, in _parse
self.raw = utils.parse_json(self.data)
File "/root/ansible/lib/ansible/utils/__init__.py", line 552, in parse_json
results = json.loads(data)
File "/usr/lib64/python2.6/json/__init__.py", line 307, in loads
return _default_decoder.decode(s)
File "/usr/lib64/python2.6/json/decoder.py", line 319, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib64/python2.6/json/decoder.py", line 338, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

有人知道是什么吗?

如果我尝试运行主机,我会得到:

 ec2-user]# /etc/ansible/hosts
Looks like AWS is down again:
EC2ResponseError: 403 Forbidden
<?xml version="1.0" encoding="UTF-8"?>
<Response><Errors><Error><Code>UnauthorizedOperation</Code><Message>You are not authorized to perform this operation.</Message></Error></Errors><RequestID>9c499f04-3fd8-47cd-a7e4-655af47c1564</RequestID></Response>

我在 AWS 控制台中的所有操作仍然成功。

最佳答案

我也遇到了这个问题。原来是我的 AWS key 有问题。这是我的建议:

  1. 验证您拥有有效的 key 。我知道这似乎很明显,但从这里开始 :-)
  2. 如果您使用 export AWS_SECRET_ACCESS_KEY=... 在您的环境中设置它们,请务必确保它们周围的标点符号正确。我的样子

export AWS_ACCESS_KEY_ID="ASFSADFSDF"(带引号)

export AWS_SECRET_ACCESS_KEY=ADSFASFAASFASDFSADSFDASDFSADF(无引号)

  1. 如果您在 .zshconfig 或 .bash_profile 中设置这些,请重新启动选项卡或窗口以确保重新读取配置文件并将您的 AWS key 加载到环境中。

希望对您有所帮助!

关于python - Ansible EC2 Python 错误 : ValueError: No JSON object could be decoded,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27333148/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com