boto/boto — pull request #2174 by dkimdon (2014-03-24 20:34:43+00:00)
Title: Add support for ELB Connection Draining attribute.

Manually tested version of ELB Connection Draining support for boto. Here is the test script I used:

[ec2-user@dev-dkimdon boto]$ cat drain-test.py
#!/usr/bin/env python

import boto
import sys

name = sys.argv[1]

draining_enabled = sys.argv[2] == 'true'
draining_timeout = sys.argv[3]

elb_conn = boto.connect_elb()
elbs = elb_conn.get_all_load_balancers()
for elb in elbs:
if elb.name == name:
print 'BEFORE'
print elb_conn.get_all_lb_attributes(elb.name)
conn_draining = elb_conn.get_lb_attribute(elb.name, 'ConnectionDraining')
print conn_draining

conn_draining.enabled = draining_enabled
conn_draining.timeout = draining_timeout

elb_conn.modify_lb_attribute(elb.name, 'ConnectionDraining', conn_draining)
print 'AFTER'
print elb_conn.get_all_lb_attributes(elb.name)
print elb_conn.get_lb_attribute(elb.name, 'ConnectionDraining')

[ec2-user@dev-dkimdon boto]$ ./drain-test.py awseb-e-3-AWSEBLoa-1OLPI5HBDGUH0 true 200
BEFORE
LbAttributes(CrossZoneLoadBalancingAttribute(False), AccessLog(False, None, None, None), ConnectionDraining(True, 242))
ConnectionDraining(True, 242)
AFTER
LbAttributes(CrossZoneLoadBalancingAttribute(False), AccessLog(False, None, None, None), ConnectionDraining(True, 200))
ConnectionDraining(True, 200)
[ec2-user@dev-dkimdon boto]$ ./drain-test.py awseb-e-3-AWSEBLoa-1OLPI5HBDGUH0 false 200
BEFORE
LbAttributes(CrossZoneLoadBalancingAttribute(False), AccessLog(False, None, None, None), ConnectionDraining(True, 200))
ConnectionDraining(True, 200)
AFTER
LbAttributes(CrossZoneLoadBalancingAttribute(False), AccessLog(False, None, None, None), ConnectionDraining(False, 200))
ConnectionDraining(False, 200)
[ec2-user@dev-dkimdon boto]$