【发布时间】:2021-07-06 14:34:05
【问题描述】:
使用 ansible=2.10.0 和 boto=2.49.0,当尝试执行 ec2_vol playbook 以管理磁盘到具有代理环境的 AWS 实例时。 收到此错误 -
connection.py",line 796, in proxy_ssl, sock.sendall("CONNECT %s HTTP/1.0\r\n" % host), TypeError: a bytes-like object is required, not 'str',
有开放的 PR 可以修复它,但尚未合并 - https://github.com/boto/boto/pull/3699。 ec2_vol 之类的社区模块也无法使用 - https://galaxy.ansible.com/community/aws。
除了使用fork来解决,比如python中的monkeypatching,有没有其他解决方案?
【问题讨论】:
-
您对用于那些
ec2_vol任务的python 解释器有影响,因此您可以通过使用python2 来解决该问题,或者(如您所述)您可以将补丁应用于boto 库作为剧本的一部分(通过lineinfile:或类似方式)
标签: python-3.x amazon-ec2 ansible boto