Comment 2 for bug 517871

Revision history for this message
Robert Collins (lifeless) wrote :

hasattr can swallow exceptions. I suggest

=== modified file 'bin/euca-describe-volumes'
--- bin/euca-describe-volumes 2009-10-12 09:11:57 +0000
+++ bin/euca-describe-volumes 2010-02-06 00:15:08 +0000
@@ -73,8 +73,11 @@
      volume_string += '\t%s' % (volume.snapshot_id)
  else:
      volume_string += '\t'
- if volume.availabilityZone:
- volume_string += '\t%s' % volume.availabilityZone
+
+ az = getattr(volume, 'availabilityZone', object)
+ if az is object: az=volume.zone
+ if az: volume_string += '\t%s' % az
+
  volume_string += '\t%s\t%s' % (volume.status, volume.create_time)
  print 'VOLUME\t%s' % (volume_string)
  if volume.status == 'in-use':