Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get useful diagnostics from boto?

How can I get useful diagnostics out of boto? All I ever seem to get is the infuriatingly useless "400 Bad Request". I recognize that boto is just passing along what the underlying API makes available, but surely there's some way to get something more useful than "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
like image 915
Roy Smith Avatar asked Jun 21 '13 02:06

Roy Smith


Video Answer


2 Answers

I didn't have much luck with putting the debug setting in the config file, but the call to ec2.connect_to_region() takes a debug parameter, with the same values as in j0nes' answer.

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

Everything that connection object sends/receives will get dumped to stdout.

like image 58
JamesOff Avatar answered Oct 24 '22 03:10

JamesOff


You can configure the boto.cfg file to be more verbose:

[Boto]
debug = 2

debug: Controls the level of debug messages that will be printed by the boto library. The following values are defined:

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
like image 23
j0nes Avatar answered Oct 24 '22 02:10

j0nes