Difference between instance.state and instance.update()

62 views
Skip to first unread message

sajuptpm

unread,
Feb 2, 2012, 1:50:02 AM2/2/12
to boto-users
Hi,
I am using
boto: 2.1.1
eucalyptus: 2.0.3

Getting exception "EC2ResponseError: EC2ResponseError: 403 Forbidden
None", when calling method update() on instance which is in 'shutting-
down' state.

I want to check whether an instance terminated or not, So what i am
doing is, in a while loop query instance with id and check state using
"update()".
It is working if use "instance.state" instead of "instance.update()".

So which is the best way to do it ???.

Chris Moyer

unread,
Feb 2, 2012, 9:23:35 PM2/2/12
to boto-...@googlegroups.com
Calling "update()" actually updates the local python object, if you just continually check "state" it will always be the same. So really you have to call update(), but it sounds like with Eucalyptus you can't query the status of an instance while it's shutting down.

Quite the conundrum, but I believe the best way to handle that may be to catch that 403 error, and then you know your instance is stopped.


--
You received this message because you are subscribed to the Google Groups "boto-users" group.
To post to this group, send email to boto-...@googlegroups.com.
To unsubscribe from this group, send email to boto-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/boto-users?hl=en.




--
Chris Moyer
Reply all
Reply to author
Forward
0 new messages