python-sdk
1 TopicPython F5SDK - Is Modify Supported?
I've been tasked with automating our code deployments and thus need to disable (or force offline) our pool members to allow that. I am logging in with an operator account and am using token authentication. While I can change make these changes in the webapp, I am unable to make the same changes via the SDK. I'm hoping someone may help me find the detail or error in my approach/syntax/logic. I'm using the code below. It executes fine, but when I look at the patch curl call from debug, it does not include the changes. I have searched far and wide to find a modify example of python code with little luck. I have found plenty of calls using update however, an operator role doesn't have ability to change the node description and thus an update call fails at current privilege level. Python SDK Version: f5-icontrol-rest==1.3.13 f5-sdk==3.0.21 Here's what the curl command looks like from debug. It doesn't capture any data to push to the patch request. curl -k -X PATCH https://<myIPHere>:443/mgmt/tm/ltm/pool/~Common~<pool name>/members/~Common~<node name>/ -H 'User-Agent: python-requests/2.21.0 f5-icontrol-rest-python/1.3.13' -H 'Accept-Encoding: gzip, deflate' -H 'Accept: */*' -H 'Connection: keep-alive' -H 'Content-Type: application/json' -H 'Content-Length: 2' -H 'X-F5-Auth-Token: <my TOKEN>' -d '{}' If I try to manually edit and execute the curl patch command and insert '{"session":"user-disabled"}' for the data, it says I have improperly formatted JSON. Any help is appreciated if someone has gone down this route. If anyone has a working modify() example, that may be what i need to get over the hump. All examples I see are people logging in as admin and using update, which will work...I just don't want to use an admin account or manager role to handle this automation if I don't have to. from f5.bigip import ManagementRoot from f5.utils.responses.handlers import Stats import json mgmt = ManagementRoot(hostname=<myIPHere>, username=<myusername>, password=<mypassword>, token=True, debug=True); myPool = mgmt.tm.ltm.pools.pool.load(partition='Common', name='<pool name>') myPoolMembers = myPool.members_s.get_collection() for poolMember in myPoolMembers: print(poolMember.raw) poolMember.session = 'user-disabled' poolMember.modify() # Here only to get curl commands for debug purposes for x in mgmt.debug_output: print() print(x)Solved1.1KViews0likes2Comments