Forum Discussion
Nate_W_50838
Jan 29, 2009Historic F5 Account
Problem disabling pool member via pyControl
I'm trying to write a very basic python script to add a pool member to an existing pool, then disable it. My script is this:
!/usr/bin/env python
import pycontrol.pyControl as pc
from pycontrol.Utils import show_status
b = pc.BIGIP(hostname='172.24.42.13', username='admin', password='admin',wsdl_files=['LocalLB.PoolMember','LocalLB.Pool'])
mbr = b.LocalLB_PoolMember
pl = b.LocalLB_Pool
new_member = [[{'address':'10.10.10.111', 'port':80}]]
pl.add_member(pool_names=['mypool'], members=new_member)
pc.disable_member(pool=['mypool'], member=[{'address':'10.10.10.111', 'port':80}])
However when I run it, I get an error of:
Loading WSDL: LocalLB.PoolMember.wsdl
Loading WSDL: LocalLB.Pool.wsdl
Traceback (most recent call last):
File "C:\Python25\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 309, in RunScript
debugger.run(codeObject, __main__.__dict__, start_stepping=0)
File "C:\Python25\Lib\site-packages\pythonwin\pywin\debugger\__init__.py", line 60, in run
_GetCurrentDebugger().run(cmd, globals,locals, start_stepping)
File "C:\Python25\Lib\site-packages\pythonwin\pywin\debugger\debugger.py", line 624, in run
exec cmd in globals, locals
File "C:\scripts\test.py", line 12, in
pc.disable_member(pool=['mypool'], member=[{'address':'10.10.10.111', 'port':80}])
TypeError: disable_member() takes at least 1 non-keyword argument (0 given)
I'm pretty new to Python, but I can't figure out what non-keyword argument disable_member() is looking for. Help!
- Nate_W_50838Historic F5 AccountAh nevermind, RTFM there is example code for this at http://devcentral.f5.com/wiki/default.aspx/iControl/pyControlTogglePoolMember.html
- L4L7_53191
Nimbostratus
Glad you're working! This brings up a good point though, and it's worth explaining it a bit as it'll almost certainly affect future additions to the Utils module for pyControl. The utility functions that are added are convenience functions that will hopefully save some cycles for folks. Because of this, we try and keep them generic and flexible. The requirement is that you pass a valid "pool member" object to the function to disable the member. This allows us to pass in different objects that refer to different systems.
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects