It seems the HMC import feature does not logoff properly from the HMC.
I didn't find a logoff function in the hmc package in the repo (sorry I'm not very fluent en Go, I found the PUT and looked for a DELETE).
I realized it when I saw 8000 REST API logons idling on one our virtual HMC which corresponds to the time when I first tried it.
import sys
def disconnect(hmc, token):
headers = {'X-API-Session' : token }
url = 'https://'+hmc+':12443/rest/api/web/Logon'
ret = requests.delete(url,headers=headers,verify=False)
rcode = ret.status_code
# REST API delete officially can respond with these three good values
if rcode == 200 or rcode == 202 or rcode == 204:
print("Successfully disconnected from the HMC")
sys.exit(0)
else:
print("Logoff failed code=%d url=%s data=%s" %(rcode, url, ret.text))
sys.exit(rcode)
Would it be possible to add this feature in the next release ?
I could help but unfortunately, I'm barely able to read Go right now.
Hi Adejoux,
It seems the HMC import feature does not logoff properly from the HMC. I didn't find a logoff function in the hmc package in the repo (sorry I'm not very fluent en Go, I found the PUT and looked for a DELETE).
I realized it when I saw 8000 REST API logons idling on one our virtual HMC which corresponds to the time when I first tried it.
Here's an example of logoff function with a DELETE request in python which works well : https://www.ibm.com/developerworks/community/blogs/aixpert/entry/Avoiding_HMC_REST_API_Session_Issues?lang=en
Would it be possible to add this feature in the next release ? I could help but unfortunately, I'm barely able to read Go right now.
Thanks