-
Couldn't load subscription status.
- Fork 269
Open
Description
`p = Protocol(
endpoint=http_request+'://'+ip+':'+port+'/wsman',
transport=transport_type,
username=usr,
password=passwrd,
ca_trust_path="httpscert.cert",
`server_cert_validation=isvalidation)``
# execute command by using command_id and shell_id
try:
shell_id = p.open_shell()
command_id = p.run_command(shell_id, cmd)
std_out, std_err, status_code = p.get_command_output(
shell_id, command_id)
# p.cleanup_command(shell_id, command_id)
# p.close_shell(shell_id)
file_status = status_code
file_output = std_out +bytes(ANY_ERROR,UTF8) + std_err
# if excpetion happend log exception with status code
except Exception as exception:
excp = (ANY_ERROR+'Exception:%s:%s' % (exception.__class__.__name__, exception))
file_output = bytes(excp,UTF8)
finally:
p.cleanup_command(shell_id, command_id)
p.close_shell(shell_id)
# convert final output as bytes
file_ip_bytes = bytes("windows:"+ip+"\n", UTF8)
file_status_bytes = bytes("status_code:"+str(file_status)+"\n",UTF8)
sep_bytes = bytes(FINAL_OUTPUT, UTF8)
file_output = file_ip_bytes+file_status_bytes+sep_bytes+file_output
Writing into file and close.
Calling above python process from go. Initially it is consuming 28mb memory consumption increasing slowly
Metadata
Metadata
Assignees
Labels
No labels