Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 754c2e32ac
executable file 43 lines (29 sloc) 0.962 kB
#!/usr/bin/env python
import getopt
import sys
from libcloud.loadbalancer.base import LoadBalancer, Member
from lctools.lc import get_lc
def usage(prog):
sys.stdout.write(("%s [-p <profile> ] -i <id> addr:port\n\n") % prog)
if __name__ == "__main__":
profile = "default"
lb_id = None
try:
opts, args = getopt.getopt(sys.argv[1:], "p:i:")
except getopt.GetoptError, err:
sys.stderr.write("%s\n" % str(err))
sys.exit(1)
for o, a in opts:
if o == "-p":
profile = a
elif o == "-i":
lb_id = a
conn = get_lc(profile, resource='loadbalancer')
if lb_id is None and len(args) != 1:
usage(sys.argv[0])
sys.exit(1)
balancer = LoadBalancer(lb_id, None, None, None, None, None)
node_addr, node_port = args[0].split(":")
sys.exit(int(not conn.balancer_attach_member(balancer,
Member(None, ip=node_addr, port=node_port))
))
Jump to Line
Something went wrong with that request. Please try again.