# ec2\_vol error: problem with instance object

**URL:** <https://forum.ansible.com/t/ec2-vol-error-problem-with-instance-object/12715>\
**Category:** Ansible Project\
**Created:** [April 24, 2013, 12:26pm UTC](https://forum.ansible.com/t/ec2-vol-error-problem-with-instance-object/12715 "2013-04-24T12:26:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robert\_Parrott](https://avatars.discourse-cdn.com/v4/letter/r/47e85d/32.png) [@Robert\_Parrott](https://forum.ansible.com/u/Robert_Parrott)\
**Post date:** [April 24, 2013, 12:26pm UTC](https://forum.ansible.com/t/ec2-vol-error-problem-with-instance-object/12715/1 "2013-04-24T12:26:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Robert\_Parrott](https://avatars.discourse-cdn.com/v4/letter/r/47e85d/32.png) [@Robert\_Parrott](https://forum.ansible.com/u/Robert_Parrott)\
**Post date:** [April 24, 2013, 12:34pm UTC](https://forum.ansible.com/t/ec2-vol-error-problem-with-instance-object/12715/2 "2013-04-24T12:34:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Lester\_Wade](https://avatars.discourse-cdn.com/v4/letter/l/97f17d/32.png) [@Lester\_Wade](https://forum.ansible.com/u/Lester_Wade)\
**Post date:** [April 24, 2013, 2:52pm UTC](https://forum.ansible.com/t/ec2-vol-error-problem-with-instance-object/12715/3 "2013-04-24T14:52:22Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Lester\_Wade](https://avatars.discourse-cdn.com/v4/letter/l/97f17d/32.png) [@Lester\_Wade](https://forum.ansible.com/u/Lester_Wade)\
**Post date:** [April 24, 2013, 2:52pm UTC](https://forum.ansible.com/t/ec2-vol-error-problem-with-instance-object/12715/4 "2013-04-24T14:52:45Z")

</div>

I’ll take a look into it this morning.

---

<div class="post-metadata">

**Author:** ![Robert\_Parrott](https://avatars.discourse-cdn.com/v4/letter/r/47e85d/32.png) [@Robert\_Parrott](https://forum.ansible.com/u/Robert_Parrott)\
**Post date:** [April 24, 2013, 3:34pm UTC](https://forum.ansible.com/t/ec2-vol-error-problem-with-instance-object/12715/5 "2013-04-24T15:34:32Z")

</div>

FYI, a fix using “hasattr” works fine.

---

<div class="post-metadata">

**Author:** ![Lester\_Wade](https://avatars.discourse-cdn.com/v4/letter/l/97f17d/32.png) [@Lester\_Wade](https://forum.ansible.com/u/Lester_Wade)\
**Post date:** [April 24, 2013, 4:46pm UTC](https://forum.ansible.com/t/ec2-vol-error-problem-with-instance-object/12715/6 "2013-04-24T16:46:47Z")

</div>

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](https://github.com/ansible/ansible/pull/2772)
