如何从boto获得有用的诊断?

时间:2013-06-21 02:54:12

标签: amazon-ec2 boto

如何从boto中获取有用的诊断信息?我似乎得到的只是真正无用的" 400 Bad Request"。我认识到boto只是传递底层API提供的内容,但肯定有某种方法可以获得比#34; Bad Request"更有用的东西。

Traceback (most recent call last):
  File "./mongo_pulldown.py", line 153, in <module>
    main()
  File "./mongo_pulldown.py", line 24, in main
    print "snap = %r" % snap
  File "./mongo_pulldown.py", line 149, in __exit__
    self.connection.delete_volume(self.volume.id)
  File "/home/roy/deploy/current/python/local/lib/python2.7/site-packages/boto/ec2/connection.py", line 1507, in delete_volume
    return self.get_status('DeleteVolume', params, verb='POST')
  File "/home/roy/deploy/current/python/local/lib/python2.7/site-packages/boto/connection.py", line 985, in get_status
    raise self.ResponseError(response.status, response.reason, body)
boto.exception.EC2ResponseError: EC2ResponseError: 400 Bad Request

2 个答案:

答案 0 :(得分:6)

你可以configure the boto.cfg提交更详细的文件:

[Boto]
debug = 2
  

debug:控制将要打印的调试消息的级别   博图书馆。定义了以下值:

0 - no debug messages are printed
1 - basic debug messages from boto are printed
2 - all boto debugging messages plus request/response messages from httplib

答案 1 :(得分:6)

我没有把调试设置放在配置文件中,但是对ec2.connect_to_region()的调用需要一个调试参数,其值与j0nes的答案相同。

ec2 = boto.ec2.connect_to_region("eu-west-1", debug=2)

连接对象发送/接收的所有内容都将被转储到stdout。