ec2_vol error: problem with instance object

Folks,

Trying a recently working playbook on the “devel” branch of ansible, I’m getting an error in the ec2_vol module.

This playbook starts an instance in EC2 using the “ec2” modules, then attaches a volume using the “ec2_vol” module; it worked about a month ago, but it looks like something changed in the data structures for the instance object, or someone is making an erroneous assumption about that object, that leads to an “AttributeError”:

The error is :

failed: [localhost] => ([redacted]) => {“failed”: true, “item”: {[redacted]}, “parsed”: false}
invalid output was: Traceback (most recent call last):
File “/Users/parrott/.ansible/tmp/ansible-1366805780.79-267706100880358/ec2_vol”, line 1050, in
main()
File “/Users/parrott/.ansible/tmp/ansible-1366805780.79-267706100880358/ec2_vol”, line 179, in main
if inst.get_password_data == ‘’:
AttributeError: ‘Instance’ object has no attribute ‘get_password_data’

The “item” is an instance object returned from the ec2 module.

Where should this be fixed? in the “ec2” modules or the “ec2_vol” module?

Thanks,
Rob

Reviewing python-boto API more closely, I don’t even see this attribute present.

What’s the intention with this chunk of code?

Thanks,
Rob

Interesting. I was just testing this yesterday after some changes to add region support to the chunk of connect code, it might be the change in import of the boto.ec2 module. This little bit regarding the password data is the way of telling whether an instance is Windows or Linux. Does the instance you are trying to attach the volume to exist in the same region and zone?

I’ll take a look into it this morning.

FYI, a fix using “hasattr” works fine.

Thanks. I ended up doing it slightly different just because I didn’t think PasswordData was an instance attribute:

https://github.com/ansible/ansible/pull/2772