Hello,
Currently if we are trying to register an instance that has not yetbeen registered with the elb an exception is thrown as follows:
Traceback (most recent call last):
File “/home/ubuntu/.ansible/tmp/ansible-1388916053.26-72858643329411/ec2_elb”, line 1412, in
main()
File “/home/ubuntu/.ansible/tmp/ansible-1388916053.26-72858643329411/ec2_elb”, line 335, in main
elb_man.register(wait, enable_availability_zone)
File “/home/ubuntu/.ansible/tmp/ansible-1388916053.26-72858643329411/ec2_elb”, line 168, in register
self.awaitelb_instance_state(lb, ‘InService’, initial_state)
File “/home/ubuntu/.ansible/tmp/ansible-1388916053.26-72858643329411/ec2_elb”, line 213, inawaitelb_instance_state
if instance_state.state != initial_state.state:
AttributeError: ‘NoneType’ object has no attribute ‘state’
This is expected because the code is querying the elb for the state of the new instance and it responds with a “InvalidInstance” response (as its not been registered with the ELB yet) and the code sets the value of the initial_state to None.
This code change checks if the initial_state is None. If it is, its safe to assume that its state has changed - https://github.com/ansible/ansible/pull/5506
I hope this is a small enough to be merged
Mphan