boto: EC2实例get_attribute导致AttributeError: 'EC2Connection'对象没有' describe_attribute'属性
复现问题的步骤是什么?
1. 尝试通过 instance.get_attribute('kernel') 获取一个运行中的 EBS 支持的实例的内核属性。
>>> import boto.ec2
>>> regions = boto.ec2.regions()
>>> regions
[RegionInfo:eu-west-1, RegionInfo:us-east-1, RegionInfo:us-west-1, RegionInfo:ap-southeast-1]
>>> usw = regions[2]
>>> conn = usw.connect()
>>> reservations = conn.get_all_instances()
>>> reservations
[Reservation:r-XXXXXXXX]
>>> r1 = reservations[0]
>>> for i in r1.instances: print i
...
Instance:i-XXXXXXXX
>>> instance = r1.instances[0]
>>> instance.get_attribute('kernel')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/boto/ec2/instance.py", line 293, in get_attribute
return self.connection.describe_attribute(self.id, attribute)
AttributeError: 'EC2Connection' object has no attribute 'describe_attribute'
>>>
预期的输出是什么?你看到的是什么?
我希望能获取到这个属性,但结果却出现了这个错误:AttributeError: 'EC2Connection' 对象没有 'describe_attribute' 这个属性。
你使用的是什么版本的产品?在什么操作系统上?
在 Mac OS X 10.5 上使用 boto.Version == 2.0b3(通过 pip 安装的 boto)。
请提供任何额外的信息。
在 GitHub 的代码库中似乎也表明没有 'describe_attribute' 这个方法。
https://github.com/boto/boto/blob/master/boto/ec2/connection.py
1 个回答
0
开发者们很快就解决了这个问题!
https://github.com/boto/boto/commit/899ab55752d31af22f41168f92fe39553504d6fc
不过在写这段话的时候,这个更新还没有上传到pypi上,所以用命令“pip install --upgrade”是没用的。你需要从GitHub上克隆代码,然后从那里安装。