Forum Discussion
Create Empty Pool with iControl in Python
Hi,
I'm trying to build an empty pool before it's populated at a later date. When I try running the following code it keeps complaining about missing the members parameter. From what I've read, you have to include a list of server/port combinations but we won't have anything to add at this time. Is there anyway around this? I've been able to do this in LTM gui but no luck via python.
lb_obj = pc.BIGIP(hostname = lb_ip,username = 'neo',password = acct,fromurl = True,wsdls = ['LocalLB.Pool'])
lb_obj.LocalLB.Pool.create(pool_names = [pool_name], lb_methods = ['0'])
3 Replies
Hello Spirello,
To create an empty pool you have to pass empty member list.
members list is mandatory for the create function, so the following code should be ok:
lb_obj.LocalLB.Pool.create(pool_names = [pool_name], lb_methods = ['LB_METHOD_ROUND_ROBIN'], [[]])Best Regards,
Guillaume
- spirrello_22970
Nimbostratus
Thanks Guillaume. I've tried that but it didn't work.
spirrello@ubuntu1:~/scripts$ python f5.py File "f5.py", line 244 lb_obj.LocalLB.Pool.create(pool_names = [pool_name], lb_methods = ['LB_METHOD_ROUND_ROBIN'],[[]]) SyntaxError: non-keyword arg after keyword arg
Hi,
It's a python code issue, my bad.
As you pass the first parameters with keywords args (pool_names= and lb_methods=) you have to pass the third with keywords args too, or the 3 parameters without keywords args.
So the code below should work:
lb_obj.LocalLB.Pool.create(pool_names = [pool_name], lb_methods = ['LB_METHOD_ROUND_ROBIN'], members=[[]])or:
lb_obj.LocalLB.Pool.create([pool_name], ['LB_METHOD_ROUND_ROBIN'], [[]])Regards,
Guillaume
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com