euca-describe-addresses fails with missing attribute on Address object

Bug #891889 reported by James Kyle
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
euca2ools
Status tracked in Devel
2.0
Fix Released
Wishlist
Unassigned
Devel
Fix Released
Wishlist
Unassigned

Bug Description

Stacktrace:

 File "/opt/local/bin/euca-describe-addresses-2.7", line 41, in <module>
    cmd.main_cli()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/euca2ools/commands/euca/describeaddresses.py", line 63, in main_cli
    self.display_addresses(addresses)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/euca2ools/commands/euca/describeaddresses.py", line 50, in display_addresses
    domain = address.domain or 'standard'
None

euca2ools Version 2.0.0, Python 2.7, Mac OS X (10.7.2), boto 2.0

Fix:

euca2ools/commands/euca/describeaddresses.py: line 50

Replace:

                domain = address.domain or 'standard'

With:
                domain = getattr(address, "domain", None)
                if not domain: domain = "standard"

I wasn't sure if this was (perhaps) a change in the bot API for the address object or not, so I just replaced with a getattr call and a default return of None...which we can then test and assign the default domain string "standard".

This would cover the explicit case currently in the code and the special case, resulting in this bug, of an undefined attribute.

Tags: canonistack
Revision history for this message
Garrett Holmstrom (gholms) wrote :

Address.domain was introduced in boto 2.1. Are you able to use a newer boto port?

Revision history for this message
James Kyle (jkyle) wrote :

I did upgrade my distress boo to 2.1.1 and may push it to the main repo after I use it a bit.

I'd note, though, that the above work around would be compatible with all versions of boto.

summary: euca-describe-addresses fails with missing attribute on Address object
+ when using boto < 2.1
Revision history for this message
Kapil Thangavelu (hazmat) wrote :

This also effects nova essex clouds, and is a problem with boto 2.2 on precise.

summary: euca-describe-addresses fails with missing attribute on Address object
- when using boto < 2.1
Revision history for this message
Kapil Thangavelu (hazmat) wrote :

i used this one liner to fix.

            domain = getattr(address, 'domain', 'standard') or 'standard'

tags: added: canonistack
Revision history for this message
Kapil Thangavelu (hazmat) wrote :

arguably this could be said to be a nova bug i suppose.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.