Forum Discussion
Chris_82142
Nimbostratus
Jun 20, 2013Can only disable a node, not enable.
Hello Everyone,
I am trying to use Pycontrol V2.0 to enable and disable a node:
!/bin/python
import sys
import pycontrol.pycontrol as pc
import suds
b = p...
msaunders
Nimbostratus
Nov 08, 2018I got errors from all of the above methods. This works for me.
import requests
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
WhichLTM = '192.168.1.100'
LTMUser = 'admin'
LTMPass = 'admin'
PoolName = 'test.domain.com_pool'
NodePort = '1.2.3.4:80'
Partition = 'Common'
def DisablePoolMember(WhichLTM, LTMUser, LTMPass, PoolName, Partition, NodePort):
headers = {'Content-Type': 'application/json',}
data = '{"session":"user-disabled"}'
response = requests.put('https://' + WhichLTM + '/mgmt/tm/ltm/pool/' + PoolName + '/members/~' + Partition + '~' + NodePort, headers=headers, data=data, verify=False, auth=(LTMUser, LTMPass))
def EnablePoolMember(WhichLTM, LTMUser, LTMPass, PoolName, Partition, NodePort):
headers = {'Content-Type': 'application/json',}
data = '{"session":"user-enabled"}'
response = requests.put('https://' + WhichLTM + '/mgmt/tm/ltm/pool/' + PoolName + '/members/~' + Partition + '~' + NodePort, headers=headers, data=data, verify=False, auth=(LTMUser, LTMPass))
DisablePoolMember(WhichLTM, LTMUser, LTMPass, PoolName, Partition, NodePort)
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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